我想创建一个带有深色背景的 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'),
),
],
),
);
},
);
}
Run Code Online (Sandbox Code Playgroud)