flutter 提示框2 Dialog
flutter 提示框 写在点击的方法体中
child里放自己喜欢的
showDialog(
context: context,
builder: (BuildContext context) {
final Dialog alertDialog = Dialog(
backgroundColor: Colors.transparent,
shadowColor:Colors.transparent,
child: Container(
height: mediawidth*0.25,
width: mediawidth*0.5,
decoration: BoxDecoration(
// color: Colors.transparent,
image: DecorationImage(
image: AssetImage('assets/images/choosed.png'),
fit: BoxFit.contain,
),
),
),
);
// 使用Future.delayed来在1秒后自动关闭对话框
Future.delayed(Duration(milliseconds: 700), () {
Navigator.of(context).pop();
});
return alertDialog;
},
);