提交 0c4781fc authored 作者: yueweilu's avatar yueweilu

退出登录 加弹窗

上级 88b9a89a
......@@ -93,17 +93,112 @@ class _UserSetPageState extends State<UserSetPage> {
),
GestureDetector(
onTap: () async {
final result = await AccountAPI.logout();
if (result) {
// Toast.show('退出成功');
CustomToast.loading();
await UserStore.to.logout();
CustomToast.dismiss();
if (context.mounted) {
context.goNamed(Routes.splash);
}
}
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w),
),
contentPadding: EdgeInsets.zero,
// 移除内容部分的内边距
content: Wrap(
children: [
Container(
margin:
EdgeInsets.only(top: 44.w, bottom: 29.w),
// 调整上下间距
child: Center(
child: Text(
'确定退出登录吗?',
style: TextStyle(
fontSize: 15.w,
fontWeight: Fonts.medium,
color: Colours.c3,
),
),
),
),
Container(
height: 1.w, // 设置分割线的高度
width: double.infinity, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
],
),
// 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero,
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'取消',
style: TextStyle(
fontSize: 15,
fontWeight: Fonts.medium,
color: Colours.c6,
),
),
),
),
Container(
height: 39.5.w, // 设置分割线的高度
width: 1, // 设置分割线的宽度
color: Colours.cLine, // 设置分割线的颜色
),
GestureDetector(
onTap: () async {
final result = await AccountAPI.logout();
if (result) {
// Toast.show('退出成功');
CustomToast.loading();
await UserStore.to.logout();
CustomToast.dismiss();
if (context.mounted) {
context.goNamed(Routes.splash);
}
}
},
child: Container(
width: 105.w,
color: Colours.cFF,
alignment: Alignment.center,
child: const Text(
'确定',
style: TextStyle(
fontSize: 15,
fontWeight: Fonts.medium,
color: Colours.cAB1941,
),
),
),
),
],
),
],
);
},
);
},
// onTap: () async {
// final result = await AccountAPI.logout();
// if (result) {
// // Toast.show('退出成功');
// CustomToast.loading();
// await UserStore.to.logout();
// CustomToast.dismiss();
// if (context.mounted) {
// context.goNamed(Routes.splash);
// }
// }
// },
child: Container(
height: 42.w,
width: double.infinity,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论