我添加了SimpleDialog2 个选项:失物招领。每当我做出选择并被重定向到我想要的位置时,SimpleDialog 不会关闭并停留在我的屏幕上。
开关:
switch (
await showDialog(
context: context,
child: new SimpleDialog(
title: new Text("Which category?"),
children: <Widget>[
new SimpleDialogOption(child: new Text("Found"),
onPressed: () {
goToCreate();
},
),
new SimpleDialogOption(child: new Text("Lost"),
onPressed: () {
//Whatever
},
),
],
)
)
)
Run Code Online (Sandbox Code Playgroud)
和案例:
{
case "Found":
goToCreate();
break;
case "Lost":
//Whatever
break;
}
Run Code Online (Sandbox Code Playgroud)