【发布时间】:2019-12-09 21:42:32
【问题描述】:
我在静态方法中有AlertDialog,因为我想在用户点击OK 按钮时获得回调。
我尝试使用typedef,但无法理解。
以下是我的代码:
class DialogUtils{
static void displayDialogOKCallBack(BuildContext context, String title,
String message)
{
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text(title, style: normalPrimaryStyle,),
content: new Text(message),
actions: <Widget>[
new FlatButton(
child: new Text(LocaleUtils.getString(context, "ok"), style: normalPrimaryStyle,),
onPressed: () {
Navigator.of(context).pop();
// HERE I WANTS TO ADD CALLBACK
},
),
],
);
},
);
}
}
【问题讨论】:
标签: function flutter callback flutter-alertdialog