44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
void main() => runApp(MyApp());
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'CupertinoAlertDialog组件示例',
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('CupertinoAlertDialog组件示例'),
|
|
),
|
|
body: Center(
|
|
//添加对话框
|
|
child: CupertinoAlertDialog(
|
|
title: Text('提示'), //对话框标题
|
|
content: SingleChildScrollView(
|
|
//对话框内容部分
|
|
child: ListBody(
|
|
children: <Widget>[
|
|
Text('是否要删除?'),
|
|
Text('一旦删除数据不可恢复!'),
|
|
],
|
|
),
|
|
),
|
|
//对话框动作按钮
|
|
actions: <Widget>[
|
|
CupertinoDialogAction(
|
|
child: Text('确定'),
|
|
onPressed: () {},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text('取消'),
|
|
onPressed: () {},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |