Iam trying to put a ListView with horizontal scrolldirection, into a Column. I already tried to wrap the ListView into a Flexible and an Expanded Widget, nothing works. I noticed several Threads but nothing helps: 4 Horizontal Listviews in a Scrollable Column in FLutter Horizontal ListView All the time the same exception occurs.
This is my build method:
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(color: Colors.grey.shade100),
child: Scaffold(
body: NestedScrollView(
controller: _scrollController,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverAppBar(
expandedHeight: 10.h,
centerTitle: true,
floating: false,
pinned: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(40))),
backgroundColor: kPrimaryColor,
flexibleSpace: FlexibleSpaceBar.createSettings(
child: FlexibleSpaceBar(
titlePadding: EdgeInsets.only(left: 0),
centerTitle: false,
title: Container(
width: 70.w,
child: Image.asset(
'assets/images/app_logo.png',
),
decoration: BoxDecoration(),
),
background: Container(
height: 10.h,
width: 100.w,
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(40)),
),
),
),
currentExtent: currentExtent,
maxExtent: maxExtent,
),
),
];
},
body: Consumer<HomeModel>(
builder: (_, provider, a) {
return Column(
children: [
Container(
width: 100.w,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Wrap(
spacing: 1.w,
children: [
SizedBox(
width: 0.1.h,
),
for (int i = 0;
i < provider.categoryChips.length;
i )
_buildCategoryFilterChip(i, provider),
SizedBox(
width: 0.1.h,
),
],
),
),
),
/************************************************************
* This following ListView throws the exception. ************
************************************************************/
ListView.separated(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: 20,
separatorBuilder: (_, __) => const Divider(),
itemBuilder: (context, int index) {
return ListTile(
title: Text('Item at $index'),
);
},
),
],
);
},
),
),
),
);
}
The following Error occurs:
======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
RenderBox was not laid out: RenderRepaintBoundary#1d5ca relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1929 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
Column Column:file:///C:/Users/mm/StudioProjects/core/lib/ui/screens/_central/tabs/home/home_tab.dart:128:22
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1929:12)
#3 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:57:18)
#4 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:829:43)
#5 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:931:32)
#6 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#7 RenderSliverFillRemainingWithScrollable.performLayout (package:flutter/src/rendering/sliver_fill.dart:92:14)
#8 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#9 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#10 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12)
#11 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#12 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#13 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#14 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#15 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#16 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#17 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#18 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#19 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#20 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#21 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#22 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#24 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#25 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#26 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#28 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#29 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#30 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#31 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#32 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#33 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1097:7)
#34 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#35 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#36 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#37 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#38 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#39 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#40 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1388:11)
#41 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#42 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#43 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#44 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#45 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#46 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#47 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#48 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:240:19)
#49 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#50 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)
#51 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:167:11)
#52 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#53 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#54 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12)
#55 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#56 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#57 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#58 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#59 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#60 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#61 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#62 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#63 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#64 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#65 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#66 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#67 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#68 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#69 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#70 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#71 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#72 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#73 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#74 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#75 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#76 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#77 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1097:7)
#78 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#79 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#80 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#82 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#83 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#84 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1388:11)
#85 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#86 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#87 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#88 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#89 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#90 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#91 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#92 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#93 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#94 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#95 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#96 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#97 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#98 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#99 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3422:13)
#100 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#102 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#103 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:745:15)
#104 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#105 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#106 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#107 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#108 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#109 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#110 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#111 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#112 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#113 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#114 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#115 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#116 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#117 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#118 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#119 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:365:14)
#120 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#121 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:365:14)
#122 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#123 RenderView.performLayout (package:flutter/src/rendering/view.dart:165:14)
#124 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1713:7)
#125 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:885:18)
#126 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
#127 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#128 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#129 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#130 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#131 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
(elided 6 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, and dart:async-patch)
The following RenderObject was being processed when the exception was fired: RenderFlex#7e932 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: paintOffset=Offset(0.0, -0.0)
... constraints: BoxConstraints(w=392.7, h=592.8)
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
RenderObject: RenderFlex#7e932 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: paintOffset=Offset(0.0, -0.0)
constraints: BoxConstraints(w=392.7, h=592.8)
size: MISSING
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
... child 1: RenderConstrainedBox#759ba relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: Size(392.7, 48.0)
... additionalConstraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... child: RenderRepaintBoundary#f3542 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#f93e7
... engine layer: OffsetEngineLayer#01287
... handles: 2
... offset: Offset(0.0, 140.3)
... size: Size(392.7, 48.0)
... metrics: 66.7% useful (2 bad vs 4 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child: RenderCustomPaint#a8458 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... size: Size(392.7, 48.0)
... child: RenderRepaintBoundary#adb4d relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#3354f
... engine layer: OffsetEngineLayer#1d243
... handles: 2
... offset: Offset(0.0, 0.0)
... size: Size(392.7, 48.0)
... metrics: 66.7% useful (2 bad vs 4 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child 2: RenderRepaintBoundary#1d5ca relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderCustomPaint#c682d relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: MISSING
... child: RenderRepaintBoundary#498de relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child: _RenderScrollSemantics#697ae relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... semantic boundary
... size: MISSING
====================================================================================================
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: RenderRepaintBoundary#1d5ca relayoutBoundary=up1 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1929 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
Column Column:file:///C:/Users/mm/StudioProjects/core/lib/ui/screens/_central/tabs/home/home_tab.dart:128:22
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1929:12)
#3 RenderBox.paintBounds (package:flutter/src/rendering/box.dart:2567:41)
#4 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:140:56)
#5 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#6 PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:206:7)
#7 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:7)
#8 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2794:15)
#9 RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#10 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#11 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#12 RenderSliverSingleBoxAdapter.paint (package:flutter/src/rendering/sliver.dart:1779:15)
#13 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#14 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#15 RenderViewportBase._paintContents (package:flutter/src/rendering/viewport.dart:660:17)
#16 PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:398:12)
#17 PaintingContext.pushClipRect (package:flutter/src/rendering/object.dart:454:7)
#18 RenderViewportBase.paint (package:flutter/src/rendering/viewport.dart:635:38)
#19 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#20 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#21 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#22 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:979:29)
#23 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:455:19)
#24 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#25 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#26 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#27 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#28 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
(elided 6 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, and dart:async-patch)
The following RenderObject was being processed when the exception was fired: RenderFlex#7e932
... needs compositing
... parentData: paintOffset=Offset(0.0, -0.0)
... constraints: BoxConstraints(w=392.7, h=592.8)
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
RenderObject: RenderFlex#7e932
needs compositing
parentData: paintOffset=Offset(0.0, -0.0)
constraints: BoxConstraints(w=392.7, h=592.8)
size: MISSING
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
... child 1: RenderConstrainedBox#759ba relayoutBoundary=up1
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: Size(392.7, 48.0)
... additionalConstraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... child: RenderRepaintBoundary#f3542 relayoutBoundary=up2
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#f93e7
... engine layer: OffsetEngineLayer#01287
... handles: 2
... offset: Offset(0.0, 140.3)
... size: Size(392.7, 48.0)
... metrics: 75.0% useful (2 bad vs 6 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child: RenderCustomPaint#a8458 relayoutBoundary=up3
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... size: Size(392.7, 48.0)
... child: RenderRepaintBoundary#adb4d relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=392.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#3354f
... engine layer: OffsetEngineLayer#1d243
... handles: 2
... offset: Offset(0.0, 0.0)
... size: Size(392.7, 48.0)
... metrics: 75.0% useful (2 bad vs 6 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child 2: RenderRepaintBoundary#1d5ca relayoutBoundary=up1 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#33ab1 DETACHED
... handles: 1
... offset: Offset(0.0, 0.0)
... size: MISSING
... metrics: 0.0% useful (1 bad vs 0 good)
... diagnosis: insufficient data to draw conclusion (less than five repaints)
... child: RenderCustomPaint#c682d relayoutBoundary=up2 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: MISSING
... child: RenderRepaintBoundary#498de relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child: _RenderScrollSemantics#697ae relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)
... semantic boundary
... size: MISSING
====================================================================================================
CodePudding user response:
Here is a simple code for ListView in Column works for me now checked
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
children: [
Expanded(
child: ListView(
scrollDirection: Axis.horizontal,
children: [
Text("sdf"),
Text("sdf"),
Text("sdf"),
],
),
),
],
)
);
}
}
CodePudding user response:
You need to wrap your ListView.separated with Sizedbox or Container and provide specific height. Any things in flutter which scrollDirection is horizontal it required height.
SizedBox(
height: 50,
child: ListView.separated(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: 20,
separatorBuilder: (_, __) => const Divider(),
itemBuilder: (context, int index) {
return ListTile(
title: Text('Item at $index'),
);
},
),
),