直播app源码,Flutter 弹窗组件
直播app源码,Flutter 弹窗组件实现的各种形式
弹窗系列组件
AlertDialog
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("提示"),
content: Text("确定删除吗?"),
actions: [
FlatButton(onPressed: () {}, child: Text("取消")),
FlatButton(onPressed: () {}, child: Text("确定")),
],
);
},
);
AlertDialog 自定义样式
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Center(child: Text("提示")),
titleTextStyle: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 30,
),
content: Center(heightFactor: 1, child: Text("确定删除吗?")),
backgroundColor: Colors.yellowAccent,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
actionsAlignment: MainAxisAlignment.center,
actions: [
FlatButton(
onPressed: () {
Navigator.of(context).pop("no");
},
child: Text("取消"),
),
FlatButton(
onPressed: () {
Navigator.of(context).pop("yes");
},
child: Text("确定"),
),
],
);
},
);
CupertinoAlertDialog IOS风格
showCupertinoDialog(
//点击空白处取消
barrierDismissible: true,
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text("提示"),
content: Text("确认删除吗?"),
actions: [
CupertinoDialogAction(
child: Text("取消"),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text("确定"),
onPressed: () {},
),
],
);
},
);
以上就是直播app源码,Flutter 弹窗组件实现的各种形式, 更多内容欢迎关注之后的文章