我希望创建一个带有黑色背景的CupertinoAlertDialog对话框。
我尝试使用Theme小部件来解决这个问题,但是它并没有起作用。
以下是一些代码:
showDialog() {
showCupertinoDialog(
context: context,
builder: (context) {
return Theme(
data: ThemeData(
dialogBackgroundColor: Colors.black,
dialogTheme: DialogTheme(backgroundColor: Colors.black)),
child: CupertinoAlertDialog(
title: Text('Title'),
content: Text('Some message here'),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('OK'),
),
],
),
);
},
);
}
CupertinoAlertDialog
的封装,因此背景颜色是硬编码的。 - BambinoUA