i have a gridmodel list view in my flutter app,i have created dart file for each of the item present in the gridview but i dont know how to give onpress function on the gridmodel list view so that it will navigate me to next page
class GridItem extends StatelessWidget {
GridModel gridModel;
GridItem(this.gridModel);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(1 / 2),
child: Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
gridModel.imagePath,
width: 30,
height: 30,
color: gridModel.color,),
Padding(
padding: const EdgeInsets.only(top: 5),
child: Text(gridModel.title, textAlign: TextAlign.center,
style: TextStyle(fontSize: 12),)
,),
],
),
),
),
);
}
}
when i will click on "Mobile" item in list,it should redirect me to "Mobile page" which i have created,same goes for "flights" and "Movies"