1

I want to (conditionally) prevent mouse hover events from affecting a certain widget (tree).

IgnorePointer

I thought that IgnorePointer would be the solution here, based on how you would prevent touch events. However, IgnorePointer does not work for mouse hovering.


How do I prevent mouse hover events from affecting my widget?

1 Answer 1

1

You can use an expanded MouseRegion in a Stack to absorb all mouse hover events for your widget:

Stack(
  children: [
    child, // <---- your widget that ignores mouse hover events.
    const MouseRegion(
      child: SizedBox.expand(),
    ),
  ],
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.