当我单击按钮时,我想在进程完成时显示一个对话框,但是虽然我添加了对话框部分,但我在屏幕上看不到 alertdialog。我在哪里做错了?这是我的代码;
child: InkWell(
onTap: () async {
final selectedLanguage =
await SharedPreferences.getInstance();
final setLanguage =
selectedLanguage.getString('selectedLanguage');
String language =
allTranslations.getLocaleKey(setLanguage);
_forgotPassword =
await createPasswordCode(_controller.text, language);
_dialog('Try');
},
child: Center(
child: Text(
'Send',
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
这是我的对话部分
Widget _dialog(String title) {
return AlertDialog(
title: Text(
title,
style: TextStyle(fontWeight: FontWeight.bold),
),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(20)),
),
actions: [
FlatButton(
child: Text('Approve'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
}