Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 4, 2020 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/1c4213209192ed883ca0689a583c15c8 to your computer and use it in GitHub Desktop.
Save ryanlid/1c4213209192ed883ca0689a583c15c8 to your computer and use it in GitHub Desktop.
CupertinoAlertDialog 组件示例
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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: () {},
)
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment