Home > Software design >  Splash effect onTap on widget
Splash effect onTap on widget

Time:04-21

it's quite difficult using InkWell to get the result i want like this, but the code it's not good. the code works fine i need more simple approach so i can give any widget with splash effect, im bored with GestureDetector since it has no effect. Do you have any better code?

enter image description here

Container(
         margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
         width: 227,
         height: 227,
         decoration: BoxDecoration(
           image: DecorationImage(
             image: NetworkImage(
                 'https://images.unsplash.com/photo-1587207433549-7d796bccc6a2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8YnV0dG9ufGVufDB8fDB8fA==&auto=format&fit=crop&w=500&q=60'),
             fit: BoxFit.cover,
           ),
         ),
         child: Material(
           color: Colors.transparent,
           child: InkWell(
             // borderRadius: BorderRadius.circular(50),
             onTap: () {},
           ),
         ),
       ),

CodePudding user response:

Try below code hope its helpful to you.Wrap your image

CodePudding user response:

MaterialButton(
            onPressed: () {},
            splashColor: Colors.white,
            minWidth: 0,
            padding: EdgeInsets.zero,
            materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
            child: Ink.image(
              image: NetworkImage(url),
              width: 227,
              height: 227,
              fit: BoxFit.cover,
            ),
          ),
  • Related