我已经看到IgnorePointer窗口小部件扑朔迷离,但是用例似乎很少见。有人可以用更多的用例和示例来详细说明吗?
例如,如果要创建自定义窗口小部件,如下图所示
Stack( children: <Widget>[ GestureDetector( child: Container( color: Colors.amber, width: 100, height: 100 ), onTap: () { print('clicked'); }, ), Container( color: Colors.green, width: 50, height: 50, ), ], ),
看起来像:
在此小部件中,您已将拍打功能添加到琥珀色容器中。但是,如果用户点击绿色容器,则您的琥珀色容器将不会受到任何触摸]