Reputation: 1
I’m using a GridView to display a grid of cards, each containing an image and some responsive text using .sp from ScreenUtil. How can I manage the mainAxisExtent of the grid so that it looks good across different screen sizes? Here's my code. The main issue is that the layout doesn’t adapt well on various screens:
Flexible(
fit: FlexFit.tight,
child: GridView.builder(
padding: EdgeInsets.zero,
itemCount: imageUrls.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisExtent: 200.sp,
mainAxisSpacing: 10.h,
crossAxisSpacing: 10.w
),
itemBuilder: (BuildContext context, int index) {
return EventCards(imageUrl: imageUrls[index],);
},),
)
i have tried to make mainAxisExtent reponsive using .sp
Upvotes: 0
Views: 22