I created a GridView Widget and added a simple Navigation to InkWell widget. I want to go to every different page when pressing different GridTiles, but I have created my GridView like this :
Widget _buildGrid(BuildContext context) => GridView.extent(
maxCrossAxisExtent: 150,
padding: const EdgeInsets.all(4),
mainAxisSpacing: 4,
crossAxisSpacing: 4,
children: _buildGridTileList(30, context));
List<Widget> _buildGridTileList(int count, BuildContext context) =>
List.generate(
count,
(i) => InkWell(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
ParaScreen(), //you can pass the index (i) in the constructor of YourWidget(i) something like this if needed
),
),
child: Container(
decoration: BoxDecoration(border: Border.all(color: Colors.black)),
child: Image.asset('images/pic$i.jpg'),
),
),
);
}
So, as you can see that the grids are created like List.generate, Note: I have tried to pass the index but it isn't working out too well.
Thanks