this is my program but it shows error gridview.builder is not scroll so it shows error
in this gridview it is not working properly it shows error
GridView.builder(
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
itemCount: 4,
itemBuilder: (BuildContext context, int index){
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Stack(overflow: Overflow.visible,
alignment: Alignment.center,
children: [
Container(
height: 200.0,
width:170.0,
padding: EdgeInsets.only(bottom: 24.0),
decoration: BoxDecoration(
color: kLightGreyColor,
borderRadius: BorderRadius.circular(32.0),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children:[
Text("Name", style: TextStyle(fontSize: 16.0,
fontWeight: FontWeight.w600,
color: klightFontColor), ),
SizedBox(height: 12.0,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children:
List.generate(5, (index) => Image.asset("assets/images/star.png", height: 20.0,))
),
SizedBox(height: 12.0,),
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"60 \nMin",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w400,
color: klightFontColor,
),
),
Column(
children:List.generate(6, (index) => Container(
height: 2.0,
width: 2.0,
margin: EdgeInsets.only(bottom: 2),
decoration: BoxDecoration(
color: kDarkGreyColor,
borderRadius: BorderRadius.circular(2.0),
),
))
),
Text(
"Hard \nLV1",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w400,
color: klightFontColor,
),
)
]),
]),
),
Positioned(
top: -190.0,
bottom: 0.0,
left: 20.0,
right: 20.0,
child:Container(
height: 80,
width:80,
child:Image.asset("assets/images/food1.png",),
)
),
]),
);
}),
I used the `singleChildscrollview()`, and `physics: ScrollPhysics(),` but still same error
just remove the shrinkWrap
or set it to false
and delete the SingleChildScrollView
if you want the GridView
to take All the space available wrap it in an Expanded
Widget