Reputation: 7638
I have a stack with some widget, and I want tat the most in top widget blocks all the gestures to the underneath widgets.
I've tried with a GestureDetector and opaque behaviour but does not work.
What is the correct approach?
Upvotes: 7
Views: 3059
Reputation: 267404
If you have shared some code, that would be better, so now I can just give you an idea, you can try AbsorbPointer
.
AbsorbPointer(child: YourWidget())
Upvotes: 2
Reputation: 3397
You can use the IgnorePointer widget to block any gesture for it's child.
IgnorePointer(
child: MyWidget(),
ignoring: true, // or false to disable this behavior
)
Also any widget that is partially overflowing the stack will not receive gestures.
Upvotes: 4