Search code examples
flutter

Inside Container onTap's inkwell not working


i'm trying to make a gallery app. i want a picture to open individually when tapped. but when I tap on a picture inkwell animation occurs but the new page doesn't open. i have defined second page in routes Here is the code of landing page

class _ImageViewState extends State<ImageView> {
  @override
  Widget build(BuildContext context) {
    return Container(
        child: PhotoView(
          maxScale: 600.0,
          minScale: 200.0,
          imageProvider: AssetImage("assets/mountain1.jpg",),
        )
    );
  }
}

and this is the code where I'm calling the above class

child: InkWell(
                          onTap: () => {const ImageView()},
                        child: Image.asset('assets/mountain1.jpg', fit: BoxFit.fill,)),

Solution

  • Inside

    OnTap method

    you can only add functionality things, you can't load widget like that. if you try to load.

    Or please provide more information here.