CupertinoAlertDialog
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('BottomNavigationBar Sample'),
),
body: new ListView(
children: <Widget>[
new CupertinoButton(child: Text('button'), onPressed: _showAlert),
],
),
);
}
Future<void> _showAlert() async {
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return CupertinoAlertDialog(
title: Text('我是title'),
content: Text('我是content'),
actions: <Widget>[
new CupertinoButton(onPressed: () {
Navigator.of(context).pop();
}, child: Text('取消')),
new CupertinoButton(onPressed: () {
Navigator.of(context).pop();
}, child: Text('确认')),
],
);
}
);
}
}
结果:

网友评论