1

As far as I know, due to this question Flutter AbsorbPointer vs IgnorePointer difference , AbsorbPointer will absorb tap event and other widgets below it will not receive tap event, but when I use AbsorbPointer like this. it still pass tap event to its parent:

GestureDetector(
      onTap: () {
        print('123'); // This still call when I tap on red container
      },
      child: Container(
        color: Colors.green,
        width: 300,
        height: 300,
        child: Center(
          child: AbsorbPointer(
            absorbing: true,
            child: GestureDetector(
              onTap: () {
                print('567');
              },
              child: Container(
                color: Colors.red,
                width: 100,
                height: 100,
              ),
            ),
          ),
        ),
      ),
    )

So my question is does AbsorbPointer only work with widget same level in Stack and doesn't work with its parent?

manhtuan21
  • 2,388
  • 2
  • 10
  • 24

1 Answers1

0

In your code absorbing property having true value. which means your red container is not clickable. so parent green container have tapped. Incase if you change absorbing property to false, red container can able to tap.

harizh
  • 326
  • 1
  • 13