Commit 85dd5c71 by tanghuan

bugfix

1 parent d02385fb
...@@ -151,39 +151,7 @@ class AccountPage extends StatelessWidget { ...@@ -151,39 +151,7 @@ class AccountPage extends StatelessWidget {
} }
final accountCubit = context.read<AccountCubit>(); final accountCubit = context.read<AccountCubit>();
showDialog<bool>( _showLogoffDialog(context, accountCubit);
context: context,
builder: (BuildContext ctx) {
return AlertDialog(
title: Text('确认注销'),
content: Text('您确定要注销当前用户吗?'),
actions: [
TextButton(
onPressed: () {
Navigator.of(ctx).pop(false);
},
child: Text('取消'),
),
TextButton(
onPressed: () {
Navigator.of(ctx).pop(true);
},
child: Text('确认'),
),
],
);
},
).then((value) {
if (value == true) {
Fluttertoast.showToast(
msg: '已申请注销,等待流程处理',
backgroundColor: Colors.green,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
);
accountCubit.unbind();
}
});
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE74C3C), backgroundColor: Color(0xFFE74C3C),
...@@ -274,4 +242,37 @@ class AccountPage extends StatelessWidget { ...@@ -274,4 +242,37 @@ class AccountPage extends StatelessWidget {
), ),
); );
} }
void _showLogoffDialog(BuildContext context, AccountCubit accountCubit) {
showDialog<bool>(
context: context,
builder: (BuildContext ctx) {
return AlertDialog(
title: Text('确认注销'),
content: Text('您确定要注销当前用户吗?'),
actions: [
TextButton(
onPressed: () {
Navigator.of(ctx).pop(false);
},
child: Text('取消'),
),
TextButton(
onPressed: () {
Navigator.of(ctx).pop(true);
Fluttertoast.showToast(
msg: '已申请注销,等待流程处理',
backgroundColor: Colors.green,
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
);
accountCubit.unbind();
},
child: Text('确认'),
),
],
);
},
);
}
} }
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!