Flutter: ListView inside Column inside Column

0

You read the title right. I have a nested widget inside a column. The widget itself is another column. The nested widget has a ListView in it, set to expanded. For some reason, Flutter doesn't like that. And I've been scratching my head all day on how to solve this. Here is my parent widget:

  @override
  Widget build(BuildContext context) {
    return StreamProvider<List<Store>>.value(
      value: DatabaseService.getStores(_cc, _zip),
      child: Column(children: [
        Container(
          decoration: BoxDecoration(
            color: Clr.primary,
            borderRadius: BorderRadius.only(
              bottomLeft: Radius.circular(16.0),
              bottomRight: Radius.circular(16.0),
            ),
          ),
          child: SafeArea(
            child: Column(children: [
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
                child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
                  Text(Strings.title, style: Styles.titleDark.copyWith(fontSize: 28.0)),
                  SizedBox(width: 8.0),
                  Text(_cc ?? '--', style: Styles.headerBoldDark),
                  Spacer(),
                  FlatButton(
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(24.0),
                      side: BorderSide(color: Clr.white, width: 1.5),
                    ),
                    splashColor: Colors.white30,
                    highlightColor: Colors.white10,
                    color: Colors.transparent,
                    child: Text(_zip ?? "Loading...", style: TextStyle(color: Clr.white)),
                    onPressed: () {},
                  ),
                ]),
              ),
              SizedBox(height: 8.0),
              StoresList(),
            ]),
          ),
        ),
      ]),
    );
  }

And here is the StoresList() widget. As you can see the parent is another Column():

  @override
  Widget build(BuildContext context) {
    final List<Booking> bookings = Provider.of<List<Booking>>(context);
    return Column(children: [
      Container(
        decoration: BoxDecoration(
          color: Clr.primary,
          borderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)),
        ),
        child: Container(
          margin: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 36.0),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(30.0),
            boxShadow: [BoxShadow(blurRadius: 12.0, offset: Offset(1.0, 3.0), color: Colors.black26)],
            color: Clr.white,
          ),
          child: TextField(
            decoration: AppInputDecor(
              "Search Stores, Clinics, Salons, Restaurants...",
              color: Colors.transparent,
              icon: Icons.search,
            ),
            onChanged: (search) => setState(() => _searchQuery = search),
          ),
        ),
      ),
      Consumer<List<Store>>(
        builder: (context, stores, _) {
          List<Store> storesVisible = stores?.where((s) => s.searchKey.contains(_searchQuery))?.toList();
          return Expanded(
            child: storesVisible == null
                ? Center(child: CircularProgressIndicator())
                : storesVisible.isEmpty
                    ? EmptyText("No Stores Found In The Area")
                    : ListView.builder(
                        itemCount: storesVisible.length,
                        itemBuilder: (context, idx) {
                          final Store store = storesVisible[idx];
                          return ListTile(
                            title: Text(store.name, style: Styles.header.copyWith(fontSize: 16.0)),
                            subtitle: Text(
                              store.address,
                              style: TextStyle(color: Clr.grey),
                              overflow: TextOverflow.fade,
                            ),
                            trailing: bookings.any((b) => b.storeID == store.id)
                                ? Icon(MdiIcons.bookmarkCheckOutline, color: Clr.primaryDark)
                                : null,
                          );
                        }),
          );
        },
      ),
    ]);
  }

I get the following error message when trying to run the code. I've tried everything the debug log tells me and it still doesn't run. Also, it would be nice if Flutter didn't just vomit all over my debug console. This is a terrible experience to debug.

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
[38;5;244mThe following assertion was thrown during performLayout():[39;49m
RenderFlex children have non-zero flex but incoming height constraints are unbounded.

[38;5;244mWhen a column is in a parent that does not provide a finite height constraint, for example if it is in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining space in the vertical direction.[39;49m
[38;5;244mThese two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child cannot simultaneously expand to fit its parent.[39;49m

[38;5;248mConsider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible children (using Flexible rather than Expanded). This will allow the flexible children to size themselves to less than the infinite remaining space they would otherwise be forced to take, and then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum constraints provided by the parent.[39;49m

[38;5;244mIf this message did not help you determine the problem, consider using debugDumpRenderTree():
  https://flutter.dev/debugging/#rendering-layer
  http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html
[39;49m[38;5;244mThe affected RenderFlex is: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244mdirection: vertical[39;49m
    [38;5;244mmainAxisAlignment: start[39;49m
    [38;5;244mmainAxisSize: max[39;49m
    [38;5;244mcrossAxisAlignment: center[39;49m
    [38;5;244mverticalDirection: down[39;49m
    [38;5;244mchild 1: RenderDecoratedBox#0a5d8 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mneeds compositing[39;49m
        [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)[39;49m
        [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
        [38;5;244msize: Size(392.7, 87.0)[39;49m
        [38;5;244mdecoration: BoxDecoration[39;49m
            [38;5;244mcolor: Color(0xff5577ee)[39;49m
            [38;5;244mborderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0))[39;49m
        [38;5;244mconfiguration: ImageConfiguration(bundle: PlatformAssetBundle#37240(), devicePixelRatio: 2.8, locale: en, textDirection: TextDirection.ltr, platform: android)[39;49m
        [38;5;244mchild: RenderPadding#b5d87 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mneeds compositing[39;49m
            [38;5;244mparentData: <none> (can use size)[39;49m
            [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
            [38;5;244msize: Size(392.7, 87.0)[39;49m
            [38;5;244mpadding: EdgeInsets(16.0, 0.0, 16.0, 36.0)[39;49m
            [38;5;244mtextDirection: ltr[39;49m
            [38;5;244mchild: RenderDecoratedBox#729b9 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                [38;5;244mneeds compositing[39;49m
                [38;5;244mparentData: offset=Offset(16.0, 0.0) (can use size)[39;49m
                [38;5;244mconstraints: BoxConstraints(0.0<=w<=360.7, 0.0<=h<=Infinity)[39;49m
                [38;5;244msize: Size(360.7, 51.0)[39;49m
                [38;5;244mdecoration: BoxDecoration[39;49m
                    [38;5;244mcolor: Color(0xffffffff)[39;49m
                    [38;5;244mborderRadius: BorderRadius.circular(30.0)[39;49m
                    [38;5;244mboxShadow: BoxShadow(Color(0x42000000), Offset(1.0, 3.0), 12.0, 0.0)[39;49m
                [38;5;244mconfiguration: ImageConfiguration(bundle: PlatformAssetBundle#37240(), devicePixelRatio: 2.8, locale: en, textDirection: TextDirection.ltr, platform: android)[39;49m
                [38;5;244mchild: RenderIgnorePointer#adebb relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                    [38;5;244mneeds compositing[39;49m
                    [38;5;244mparentData: <none> (can use size)[39;49m
                    [38;5;244mconstraints: BoxConstraints(0.0<=w<=360.7, 0.0<=h<=Infinity)[39;49m
                    [38;5;244msize: Size(360.7, 51.0)[39;49m
                    [38;5;244mignoring: false[39;49m
                    [38;5;244mignoringSemantics: implicitly false[39;49m
    [38;5;244mchild 2: RenderRepaintBoundary#ee9bd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mneeds compositing[39;49m
        [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244msize: MISSING[39;49m
        [38;5;244musefulness ratio: no metrics collected yet (never painted)[39;49m
        [38;5;244mchild: RenderCustomPaint#04820 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mneeds compositing[39;49m
            [38;5;244mparentData: <none>[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244msize: MISSING[39;49m
            [38;5;244mchild: RenderRepaintBoundary#a1883 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                [38;5;244mneeds compositing[39;49m
                [38;5;244mparentData: <none>[39;49m
                [38;5;244mconstraints: MISSING[39;49m
                [38;5;244msize: MISSING[39;49m
                [38;5;244musefulness ratio: no metrics collected yet (never painted)[39;49m
                [38;5;244mchild: _RenderScrollSemantics#b4490 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                    [38;5;244mneeds compositing[39;49m
                    [38;5;244mparentData: <none>[39;49m
                    [38;5;244mconstraints: MISSING[39;49m
                    [38;5;244msemantic boundary[39;49m
                    [38;5;244msize: MISSING[39;49m
[38;5;244mThe creator information is set to: Column ← StoresList ← Column ← MediaQuery ← Padding ← SafeArea ← DecoratedBox ← Container ← Column ← _DefaultInheritedProviderScope<List<Store>> ← StreamProvider<List<Store>> ← HomeTab ← ⋯[39;49m
[38;5;244mThe nearest ancestor providing an unbounded width constraint is: RenderFlex#70bee relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m

[38;5;248mSee also: https://flutter.dev/layout/[39;49m

[38;5;244mIf none of the above helps enough to fix this problem, please don't hesitate to file a bug:
  https://github.com/flutter/flutter/issues/new?template=BUG.md
[39;49m[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0      RenderFlex.performLayout.<anonymous closure>[39;49m
[38;5;244m#1      RenderFlex.performLayout[39;49m
[38;5;244m#2      RenderObject.layout[39;49m
[38;5;244m#3      RenderFlex.performLayout[39;49m
[38;5;244m#4      RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
    [38;5;244mneeds compositing[39;49m
    [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)[39;49m
    [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
    [38;5;244msize: MISSING[39;49m
    [38;5;244mdirection: vertical[39;49m
    [38;5;244mmainAxisAlignment: start[39;49m
    [38;5;244mmainAxisSize: max[39;49m
    [38;5;244mcrossAxisAlignment: center[39;49m
    [38;5;244mverticalDirection: down[39;49m
    [38;5;244mchild 1: RenderDecoratedBox#0a5d8 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mneeds compositing[39;49m
        [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)[39;49m
        [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
        [38;5;244msize: Size(392.7, 87.0)[39;49m
        [38;5;244mdecoration: BoxDecoration[39;49m
            [38;5;244mcolor: Color(0xff5577ee)[39;49m
            [38;5;244mborderRadius: BorderRadius.only(bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0))[39;49m
        [38;5;244mconfiguration: ImageConfiguration(bundle: PlatformAssetBundle#37240(), devicePixelRatio: 2.8, locale: en, textDirection: TextDirection.ltr, platform: android)[39;49m
        [38;5;244mchild: RenderPadding#b5d87 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mneeds compositing[39;49m
            [38;5;244mparentData: <none> (can use size)[39;49m
            [38;5;244mconstraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=Infinity)[39;49m
            [38;5;244msize: Size(392.7, 87.0)[39;49m
            [38;5;244mpadding: EdgeInsets(16.0, 0.0, 16.0, 36.0)[39;49m
            [38;5;244mtextDirection: ltr[39;49m
            [38;5;244mchild: RenderDecoratedBox#729b9 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                [38;5;244mneeds compositing[39;49m
                [38;5;244mparentData: offset=Offset(16.0, 0.0) (can use size)[39;49m
                [38;5;244mconstraints: BoxConstraints(0.0<=w<=360.7, 0.0<=h<=Infinity)[39;49m
                [38;5;244msize: Size(360.7, 51.0)[39;49m
                [38;5;244mdecoration: BoxDecoration[39;49m
                    [38;5;244mcolor: Color(0xffffffff)[39;49m
                    [38;5;244mborderRadius: BorderRadius.circular(30.0)[39;49m
                    [38;5;244mboxShadow: BoxShadow(Color(0x42000000), Offset(1.0, 3.0), 12.0, 0.0)[39;49m
                [38;5;244mconfiguration: ImageConfiguration(bundle: PlatformAssetBundle#37240(), devicePixelRatio: 2.8, locale: en, textDirection: TextDirection.ltr, platform: android)[39;49m
                [38;5;244mchild: RenderIgnorePointer#adebb relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                    [38;5;244mneeds compositing[39;49m
                    [38;5;244mparentData: <none> (can use size)[39;49m
                    [38;5;244mconstraints: BoxConstraints(0.0<=w<=360.7, 0.0<=h<=Infinity)[39;49m
                    [38;5;244msize: Size(360.7, 51.0)[39;49m
                    [38;5;244mignoring: false[39;49m
                    [38;5;244mignoringSemantics: implicitly false[39;49m
    [38;5;244mchild 2: RenderRepaintBoundary#ee9bd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
        [38;5;244mneeds compositing[39;49m
        [38;5;244mparentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight[39;49m
        [38;5;244mconstraints: MISSING[39;49m
        [38;5;244msize: MISSING[39;49m
        [38;5;244musefulness ratio: no metrics collected yet (never painted)[39;49m
        [38;5;244mchild: RenderCustomPaint#04820 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
            [38;5;244mneeds compositing[39;49m
            [38;5;244mparentData: <none>[39;49m
            [38;5;244mconstraints: MISSING[39;49m
            [38;5;244msize: MISSING[39;49m
            [38;5;244mchild: RenderRepaintBoundary#a1883 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                [38;5;244mneeds compositing[39;49m
                [38;5;244mparentData: <none>[39;49m
                [38;5;244mconstraints: MISSING[39;49m
                [38;5;244msize: MISSING[39;49m
                [38;5;244musefulness ratio: no metrics collected yet (never painted)[39;49m
                [38;5;244mchild: _RenderScrollSemantics#b4490 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
                    [38;5;244mneeds compositing[39;49m
                    [38;5;244mparentData: <none>[39;49m
                    [38;5;244mconstraints: MISSING[39;49m
                    [38;5;244msemantic boundary[39;49m
                    [38;5;244msize: MISSING[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#ef156 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mSafeArea[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/erflow.shopsaf(27968): Background concurrent copying GC freed 46405(1559KB) AllocSpace objects, 11(500KB) LOS objects, 49% free, 2806KB/5612KB, paused 2.549ms total 186.541ms

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPadding#55a54 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderDecoratedBox#1e3cf relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#70bee relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mScaffold[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
The method '>' was called on null.
Receiver: null
Tried calling: >(1e-10)
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
Reloaded 0 of 581 libraries in 648ms.

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#ef156 relayoutBoundary=up4 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mSafeArea[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPadding#55a54 relayoutBoundary=up3 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderDecoratedBox#1e3cf relayoutBoundary=up2 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#70bee relayoutBoundary=up1 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mScaffold[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
The method '>' was called on null.
Receiver: null
Tried calling: >(1e-10)
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#4fc87 relayoutBoundary=up5 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#ef156 relayoutBoundary=up4 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mSafeArea[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPadding#55a54 relayoutBoundary=up3 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderDecoratedBox#1e3cf relayoutBoundary=up2 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#70bee relayoutBoundary=up1 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1694 pos 12: 'hasSize'
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mScaffold[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
The method '>' was called on null.
Receiver: null
Tried calling: >(1e-10)
[38;5;244mThe relevant error-causing widget was[39;49m
    [38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
listview
flutter
flutter-layout
asked on Stack Overflow Jun 13, 2020 by Adifyr

1 Answer

0

The solution is to wrap your ListView.builder() with an Expanded() and inside your builder, use shrinkWrap: true. Here is the code:

ListView.builder(      
  shrinkWrap: true,
  itemCount: storesVisible.length,
  itemBuilder: (context, idx) {
    final Store store = storesVisible[idx];
  },
);
answered on Stack Overflow Jun 13, 2020 by A R • edited Jul 9, 2020 by Adifyr

User contributions licensed under CC BY-SA 3.0