我想(有条件地)防止鼠标悬停事件影响某个小部件(树)。
IgnorePointer
我认为IgnorePointer
是基于how you would prevent touch events的解决方案。但是,IgnorePointer
不能用于鼠标悬停。
如何防止鼠标悬停事件影响我的小部件?
答案 0 :(得分:0)
您可以在Stack
中使用展开的MouseRegion
来吸收窗口小部件的所有鼠标悬停事件:
Stack(
children: [
child, // <---- your widget that ignores mouse hover events.
const MouseRegion(
child: SizedBox.expand(),
),
],
);