Home > other >  I try to navigate page through clicking an image
I try to navigate page through clicking an image

Time:04-04

I am new to flutter. Im trying to navigate page through clicking an image but it keep messing around. enter image description here below show before and after i make changesenter image description here enter image description here

CodePudding user response:

you can use inkwell

inkwell has so many property like color etc..... it's a rectangular area of a Material that responds to touch.

 InkWell(
        splashColor: Colors.transparent,
        highlightColor: Colors.transparent,
        focusColor: Colors.transparent,
        hoverColor: Colors.transparent,
        onTap: () {
        Navigator.pushReplacementNamed(context, "/you'r destination page");
        },
        child: Image.asset(" you'r image path ")
        )

it provides tapping section , using onTap you can tap what ever you want

OR

you can use GestureDetector

GestureDetector(
        onTap: () {
        Navigator.pushReplacementNamed(context, "/you'r destination page");
        },
         child: Image.asset(" you'r image path ")
        )

it also recognize gestures that correspond to its non-null callbacks.

CodePudding user response:

You need to wrap your Image with the gesture detector, right now they are in the same column but not together ie

GestureDetector(
onTap: DoNavigationHere,
Child: Image.asset
)
  • Related