添加点击事件
IgnorePointer阻止里面的事件响应
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Container"),
),
body: GestureDetector(
onTap: () {
print("out tap");
},
child: Container(
width: 200,
height: 200,
alignment: Alignment.center,
color: Colors.red,
child: IgnorePointer(
child: GestureDetector(
onTap: () {
print("inner tap");
},
child: Container(
width: 100,
height: 100,
color: Colors.blue,
),
),
),
),
),
);
}