flutter——ios风格的弹窗
【代码】flutter——ios风格的弹窗。
·
ios风格的弹窗
showDialog(
context: context,
builder: (BuildContext context){
return CupertinoTheme(
data: CupertinoThemeData(
// 设置暗色背景
brightness: Brightness.dark
),
child: CupertinoAlertDialog(
title: Text("提示",style: TextStyle(color: Colors.white,fontSize: 16,fontWeight: FontWeight.normal),),
content: Text("取消编辑将不保留已进行的更改,是否确认退出编辑?",style: TextStyle(fontWeight: FontWeight.normal),),
actions: [
CupertinoDialogAction(
child: const Text("取消编辑",style: TextStyle(color: Colors.white,fontSize: 14),),
onPressed: () {
Navigator.pop(context, "取消");
},
),
CupertinoDialogAction(
child: const Text("继续编辑",style: TextStyle(color: Colors.white,fontSize: 14),),
onPressed: () {
Navigator.pop(context, "确定");
},
),
],
),
);
}
);
普通的手机弹框
return AlertDialog(
backgroundColor: Color(0xff1A1A1A),
title: Center(
child: Text("提示",style: TextStyle(color: Colors.white,fontSize: 16),),
),
content: Text("取消编辑将不保留已进行的更改,是否确认退出编辑?",style: TextStyle(fontWeight: FontWeight.normal),),
actions: [
TextButton(
onPressed: (){
},
child: Text("取消编辑",style: TextStyle(color: Colors.white),),
),
TextButton(
onPressed: (){
},
child: Text("继续编辑",style: TextStyle(color: Colors.white),),
),
],
);
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)