I have a SingleChildScrollView Widget, which contains a Column child. The Column child contains two custom widget. The first custom widget is a carousel slider widget. The second custom widget is an Expanded widget, which contains a SmartRefresher widget, which contains a ListView
.
SingleChildScrollView(
child: Column(
children: [
CarouselSlider(...),
Expanded(
child: SmartRefresher(
child: ListView(...),
),
)
],
),
),
The reason I am using a SingleChildScrollView
is that I would like the carousel slider to scroll together with the list view when the user starts to scroll on the list view, but I do not want the
CarouselSlider
to be part of the list itself.
When I try to run the code, I get the following error:
The following RenderObject was being processed when the exception was fired: RenderFlex#783cc relayoutBoundary=up17 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE RenderObject: RenderFlex#783cc relayoutBoundary=up17 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE needs compositing parentData: (can use size) constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity) size: MISSING direction: vertical mainAxisAlignment: start mainAxisSize: max crossAxisAlignment: center verticalDirection: down child 1: RenderPadding#8076a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE needs compositing parentData: offset=Offset(0.0, 0.0); flex=null; fit=null constraints: MISSING
ListView
and just usecolumn
in this case. – Yeasin SheikhExpanded
doesn't know what space it lives in. It's like "expanded to... what?" TheColumn
andSingleChildScrollView
cannot have height. You should wrap youColumn
in aContainer(height: MediaQuery.of(context).size.height)
or some other widget that can define the size of the container for whichExpanded
can grow. – daddygamesListView
as expanded. TheListView
needs to know how much space to fill. So when it gets wrapped in a non-sized widget, it can get confused about what space to fill in the UI. – daddygames