void _showDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text("Alert Dialog title"),
content: new Text("Alert Dialog body"),
actions: <Widget>[
// usually buttons at the bottom of the dialog
new FlatButton(
child: new Text("Close"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
Run Code Online (Sandbox Code Playgroud)
我需要创建这个事件,在显示对话窗口的那一刻,屏幕的其他部分改变颜色,我在咨询其他来源时遇到了麻烦,事实是我无法与该事件重合。
目标是实现这样的目标:
只需将barrierColor参数传递给showDialog
showDialog(
context: context,
barrierColor: Color(0x640000FF),
builder: (BuildContext context) {
return AlertDialog(
// ...
);
},
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5394 次 |
| 最近记录: |