0

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%3D%3D&auto=format&fit=crop&w=500&q=60'),
             fit: BoxFit.cover,
           ),
         ),
         child: Material(
           color: Colors.transparent,
           child: InkWell(
             // borderRadius: BorderRadius.circular(50),
             onTap: () {},
           ),
         ),
       ),
CCP
  • 886
  • 1
  • 10
  • 30

2 Answers2

0

Try below code hope its helpful to you.Wrap your Inkwell inside Ink.image().

Container(
            width: 227,
            height: 227,
            child: Ink.image(
              image: NetworkImage('https://images.unsplash.com/photo-1587207433549-7d796bccc6a2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8YnV0dG9ufGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=500&q=60'),
              fit: BoxFit.cover,
              child: InkWell(
                onTap: () {},
              ),
            ),
          ),

You can refer my answer here also.

Result screen-> image

Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
0
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,
            ),
          ),
DholaHardik
  • 462
  • 1
  • 4
  • 7