Flutter: RenderBox was not laid out when working with ListView
This happens often when you're trying to place Scrollable widget into an infinite heigth widget or infinite heigth (Column
) widget into scrollable (SingleChildScrollView
,ListView
) .
This means you're trying to use SingleChildScrollView
> Column
> ListView
> Column
You should add following property to Column
an ListView
Widget build(BuildContext context) { return SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, // Use children total size children: [ ListView.builder( itemCount : 10, shrinkWrap: true, // Use children total size itemBuilder : (a, b)=>Text("ffffffffffff") ) ], ),); }
use this line inside column mainAxisSize: MainAxisSize.min
in place this line mainAxisAlignment: MainAxisAlignment.center
,also this line shrinkWrap: true
inside ListView.builder and this physics: NeverScrollableScrollPhysics()
And put this line physics: AlwaysScrollableScrollPhysics()
inside the SingleChildScrollView, because you cannot repeatedly scroll in more than one widget (SingleChildScrollView,ListView.builder) in this case.