flutter_staggered_grid_view
flutter_staggered_grid_view copied to clipboard
Nested MasonryGridView inside a column cause Exception
Hi, Nested MasonryGridView inside a column cause Exception: FlutterError (Vertical viewport was given unbounded height.
I am using version 0.6.0.
body: SingleChildScrollView( child: Material( child: Column( children: [ MasonryGridView.count( crossAxisCount: 4, mainAxisSpacing: 4, crossAxisSpacing: 4, itemBuilder: (context, index) { return Tile( index: index, extent: (index % 5 + 1) * 100, ); }, ),],),),)
If I add two properties: `` shrinkWrap: true, physics: NeverScrollableScrollPhysics(),
`` I can not navigate to this page anymore.
Thanks for any advice.
It seems like you gave a Column an infinite height, I don't see why you need a SingleChildScrollView and a Column here. Why don't you use only a MasonryGridView.count?
I face same issue, I want to use Colum + SingleChildScrollView for add some thing like header abrove MasonryGridView (or footer after MasonryGridView).
For GridView, it work after add shrinkWrap: true and physics: NeverScrollableScrollPhysics(),
Can MasonryGridView do same thing?
Adding shrinkWrap to true and physics to NeverScrollableScrollPhysics is a signal that we are in the wrong direction.
To achieve these kind of particular effects, you can use a CustomScrollView. In the first sliver you will add your header (wrapped with a SliverToBoxAdapter if it's a box), then you can use a SliverMasonryGrid as the second child.