Flutter - InkWell why affect on Margin area of container

Viewed 1648
     body: InkWell(
        onTap: (){
          print("optap");
        },
        child: Container(
          width: 100,
          height: 200,
          color: Colors.red,
          margin: EdgeInsets.fromLTRB(100, 200, 0, 0),
        ),
      )

Container has a Margin. A InkWell wrapped the container, when I clicked the margin area of the container, the "onTap" method will call, why? I change the InkWell to GestureDector, it is ok.

1 Answers

An InkWell's splashes will not properly update to conform to changes if the size of its underlying Material, where the splashes are rendered, changes during animation. You should avoid using InkWells within Material widgets that are changing size.

use GestureDetector, for listening for gestures without ink splashes.

Related