class MyAlertDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'AlertDialog组件示例',
home: Scaffold(
appBar: AppBar(
title: Text('AlertDialog组件示例'),
),
body: Center(
child: AlertDialog(
title: Text('提示'), //对话框标题
content: SingleChildScrollView(
//对话框内容部分
child: ListBody(
children: <Widget>[
Text('是否要删除?'),
Text('一旦删除数据不可恢复!'),
],
),
),
actions: <Widget>[
FlatButton(
child: Text('确定'),
onPressed: () {},
),
FlatButton(
child: Text('取消'),
onPressed: () {},
),
],
),
),
),
);
}
}
网友评论