Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 3, 2020 12:58
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/76530b0c8bb71a9a4b3f4a237f84a8e4 to your computer and use it in GitHub Desktop.
Save ryanlid/76530b0c8bb71a9a4b3f4a237f84a8e4 to your computer and use it in GitHub Desktop.
AlertDialog 提示对话框
import 'package:flutter/material.dart';
void main(){
runApp(MyApp());
}
class MyApp 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: (){},
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment