【发布时间】:2021-03-04 18:23:14
【问题描述】:
按下按钮后,我想打开一个 AlertDialog,但前提是变量 bool showAlert 为真。
到目前为止,这是我的代码:
FlatButton(
child: Text("HIER"),
onPressed: () {
return AlertDialog(
title: Text("HI"),
content: Text("Are you there?"),
actions: [
FlatButton(child: Text("Yes"), onPressed: () {},),
FlatButton(child: Text("No"), onPressed: () {},)
],
elevation: 24,
);
},
),
对于我的问题(如果 bool 为真则打开警报),问题是,AlertDialog 没有打开。
有什么解决办法吗?谢谢
【问题讨论】: