I am trying to make my whole page scrollable on my app, but for some unknown reason, only the grid view is scrolling can someone help me figure out why this is happening? Thanks a million.
Here is my code:
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Container(
width: double.infinity,
height: SizeConfig.screenHeight / 2.5,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/food2.png'),
fit: BoxFit.cover)),
),
const Align(
alignment: Alignment.centerLeft,
child: Text(
"Donation Cards",
style: TextStyle(
fontFamily: 'Quicksand',
fontSize: 31,
color: Colors.black,
fontWeight: FontWeight.w300,
),
),
),
const Divider(color: Colors.black38),
const SizedBox(
height: 20,
),
Expanded(
child: GridView.count(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
children: _listItem
.map((item) => Card(
color: Colors.transparent,
elevation: 0,
//child: GestureDetector(
child: GestureDetector(
onTap: () => Navigator.pushNamed(context, item.route),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
image: AssetImage(item.image),
fit: BoxFit.cover)),
)),
))
.toList(),
))
],
),
);
}
}
Thanks once again!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CodePudding user response:
Colunm wrap with singlechildscrollview and give gridview physics:NeverScrollableScrollPhysics()