点击ok后获取到ok的事件

~~~
async 将一个方法变成异步,总是和await 一起使用
~~~
~~~
import 'package:flutter/material.dart';
class AlertDemo extends StatefulWidget {
@override
_AlertDemoState createState() => _AlertDemoState();
}
class _AlertDemoState extends State<AlertDemo> {
_alertDialog() async{
var result = await showDialog(
context: context,
builder: (context){
return AlertDialog(
title: Text('aa'),
content: Text('AAAA?'),
actions: <Widget>[
RaisedButton(
child: Text('ok'),
onPressed: (){
Navigator.pop(context,'ok');
}
),
RaisedButton(
child: Text('close'),
onPressed: (){
}
),
],
);
}
);
print(result);
return result;
}
_simpleDialog() async{
}
_modelBottomSheet() async{
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Alert'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text('_alertDialog'),
onPressed: _alertDialog
),
SizedBox(height: 20),
RaisedButton(
child: Text('_simpleDialog'),
onPressed: _simpleDialog
),
SizedBox(height: 20),
RaisedButton(
child: Text('_modelBottomSheet'),
onPressed: _modelBottomSheet
),
SizedBox(height: 20),
],
),
);
}
}
~~~
*****
自定义Alert

使用

// 定时关闭

- 开始
- 盒子(容器)
- 盒子属性
- 盒子圆角属性
- Padding
- Transform(旋转)
- Alignment(文字显示位置)
- 备注
- 给任何元素加点击事件
- 主题
- Text
- overflow(文字溢出处理)
- textScaleFactor(文字缩放倍率)
- maxLines
- TextAlign
- TextStyle(字体样式)
- 图片
- 本地引入
- 远程引入
- 属性
- 圆形图片功能实现方法1
- 圆形图片功能实现方法2
- 列表
- 垂直列表
- Demo
- 图文列表
- 全图列表
- 水平列表
- 动态列表(使用自定义列表)
- 动态列表(官方API)
- 页面布局
- 网格布局(更强大的布局)
- GridView(竖xiang)
- 使用DEMO
- GridView.builder(不常用)
- 横向布局(ROW)
- (Column)垂直布局
- Stack层叠组件
- AspectRatio(比例继承上层组件宽高)
- Card组件
- Wrap(流布局)
- Expanded自适应
- 按钮
- 凸起|基本按钮
- 凸起-阴影按钮
- 自适应按钮
- 按钮加图标
- 圆角按钮
- 圆按钮
- 常按水波纹设置
- OutlineButton按钮
- ButtonBar按钮组
- 浮动按钮
- 有状态组件
- DEMO
- 底部导航
- 底部导航实现点击切换
- 代码分离+底部切换+内容切换
- 页面传值|页面跳转
- 右下角浮动按钮
- 命名路由|动态传参|推荐|项目基础架构
- 备注函数
- 路由
- 导航栏
- 子导航
- 抽屉
- 顶部加按钮
- 设置bar高度
- 表单
- CheckBox
- Radio
- FORM-DEMO
- 日期
- 常用第三方
- swiper
- ALert
- HandleAlert
- 网络
- 请求
- Body
- scrollDirection
