如何解决标题未显示在AlertDialog小部件Flutter中
Provider.of<Products>(context,listen: false)
.addProducts(_editedProduct)
.catchError((error) {
return showDialog<Null>(
context: context,builder: (ctx) {
return AlertDialog(
title: Text(
'An error occurred',),content: Text('SomethingWent Wrong'),actions: [
FlatButton(
child: Row(
children: [
Icon(Icons.close),Text('Close'),],onPressed: () {
Navigator.of(context).pop();
},)
],);
},);
}).then((value) {
setState(() {
_isLoading = false;
});
Navigator.of(context).pop();
});
我能够显示警报对话框,但无法显示标题。我找不到原因。 一切正常,除了标题未显示。
解决方法
return AlertDialog(
title: Text('AlertDialog Title'),content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text('This is a demo alert dialog.'),Text('Would you like to approve of this message?'),],),actions: <Widget>[
FlatButton(
child: Text('Approve'),onPressed: () {
Navigator.of(context).pop();
},
尝试一下,看看是否可行。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。