showDeleteDialog(element) async {
var result = await showDialog(
context: context,
barrierDismissible: true, //表示点击灰色背景的时候是否消失弹出框
builder: (context) {
return AlertDialog(
title: Text('确定该操作么?'),
actions: [
TextButton(
child: const Text('确定'),
onPressed: () async {
// 操作
Navigator.of(context).pop();
},
),
TextButton(
child: const Text('取消'),
onPressed: () async {
Navigator.of(context).pop();
},
),
],
);
});
}
flutter 提醒框 AlertDialog
于 2024-07-07 03:59:39 首次发布