xster
xster

Reputation: 6687

How to make subtree ignore touch?

Consider a Stack with 2 children. How to make the widget on top (along with all its children) ignore touches so the bottom widget can handle them?

Upvotes: 1

Views: 541

Answers (2)

CopsOnRoad
CopsOnRoad

Reputation: 268504

You can wrap the widget which should ignore touch in AbsorbPointer.

Example:

Stack(
  children: [
    AbsorbPointer(child: Child1()), // it will ignore touches
    Child2(),
  ]
) 

Upvotes: 1

Shady Aziza
Shady Aziza

Reputation: 53347

What you are looking for is the IgnorePointer widget, which will enable you to ignore any touch events to its subtree.

Upvotes: 3

Related Questions