@_@
I was thinking to make the widgets inside the GridView to have a different height according to their dynamic content height.
The widget looks like this:
Container(
decoration: BoxDecoration(
color: someColor,
borderRadius: BorderRadius.circular(17),
),
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(17),
child: AspectRatio(
aspectRatio: 5 / 3,
child: Image.network(someImageUrl, fit: BoxFit.cover),
),
),
SizedBox(height: 10),
Text('Group name'),
Text('Group desc'),
SizedBox(height: 10),
Expanded(
child: Row(
children: List.generate(
_group.popIds.length,
(_) => SizedBox(width: 50, height: 50),
),
),
),
Text('Hello')
],
),
);
And this is the screen that holds those widgets:
Scaffold(
body: Padding(
padding:
const EdgeInsets.only(left: 17.0, right: 17.0, top: 50),
child: StaggeredGridView.countBuilder(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
itemCount: 50,
itemBuilder: (context, index) => GroupItem(),
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
),
),
);
And here is the error message:
** RenderFlex children have non-zero flex but incoming height constraints are unbounded. & RenderBox was not laid out: RenderFlex#f808c relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE 'package:flutter/src/rendering/box.dart': Failed assertion: line 1940 pos 12: 'hasSize'
**
Are there some genius can help me with this issue, since I've been struggling with it for a whole day!~ @_@