Problem: I want to use widget in my gridview builder, but the items in the grid keep overflowing.
Image (Code below):
Code:
This is the GriView.builder:
return Expanded(
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
padding: EdgeInsets.symmetric(
horizontal: 27.w,
),
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
itemCount:
Provider.of<MainElementList>(context).lookbackList.length,
//
itemBuilder: (context, index) {
return HistoryThumb(
index: index + 1,
usedFrom: 'lookbackScreen',
);
}),
This is HistoryThumb, the widget that is dispalyed in the grid:
return Column(
children: [
//THIS IS THE CARD WITH THE DATE
HistoryThumbHeader(displayDate: displayDate, usedFrom: usedFrom),
//
SizedBox(
height: usedFrom == 'homeScreen' ? 7.h : 12.h,
),
GestureDetector(
onTap: () {
//irrelevant
},
//THIS IS THE RECTANGLE
child: ClipRRect(
borderRadius: BorderRadius.circular(8.r),
child: Container(
padding: EdgeInsets.all(0),
height: historyThumbSize,
width: historyThumbSize,
color: Provider.of<MainElementList>(context).allTasksDone(index)
? customColorScheme['Shade 2']
: customColorScheme['Shade 1'],
//
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
//irrelevant
],
),
),
),
),
],
);
What the design is supposed to look like in the end: