阻止点击,可以控制界面中的某一部分不受点击的影响
Widget build(BuildContext context) {
return Stack(
alignment: AlignmentDirectional.center,
children: [
SizedBox(
width: 200.0,
height: 100.0,
child: ElevatedButton(
onPressed: () {},
child: null,
),
),
SizedBox(
width: 100.0,
height: 200.0,
child: AbsorbPointer(
absorbing: true,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue.shade200,
),
onPressed: () {},
child: null,
),
),
),
],
);
}
也可以设置成其他类型的按钮,如圆角,圆形等