AbsorbPointer AbsorbPointer是一种禁止用户输入的控件,比如按钮的点击、输入框的输入、ListView的滚动等,你可能说将按钮的 设置为null,一样也可以实现,是的,但Abs
AbsorbPointer(
child: Row(
children: <Widget>[
RaisedButton(onPressed: (){},),RaisedButton(onPressed: (){},],)
AbsorbPointer(
absorbing: false,...
)
IgnorePointer(
child: Row(
children: <Widget>[
RaisedButton(onPressed: (){},)
return Container(
height: 200,width: 200,child: Stack(
alignment: Alignment.center,children: <Widget>[
Listener(
onPointerDown: (v) {
print('click red');
},child: Container(
color: Colors.red,Listener(
onPointerDown: (v) {
print('click red');
},child: Container(
color: Colors.blue,width: 100,height: 100,);
flutter: click blue
flutter: click red
return Container(
height: 200,child: Stack(
alignment: Alignment.center,children: <Widget>[
Listener(
onPointerDown: (v) {
print('click red');
},child: Container(
color: Colors.red,Listener(
onPointerDown: (v) {
print('click blue self');
},child: AbsorbPointer(
child: Listener(
onPointerDown: (v) {
print('click blue child');
},);
flutter: click blue self
flutter: click red