提交 1486cb3c authored 作者: yueweilu's avatar yueweilu

Merge remote-tracking branch 'origin/test' into test

part of user_security; part of user_security;
class UserSecurityPage extends StatefulWidget { class UserSecurityPage extends StatefulWidget {
final UserInfoModel model; final UserInfoModel model;
const UserSecurityPage({
Key? key, const UserSecurityPage({Key? key, required this.model}) : super(key: key);
required this.model
}) : super(key: key);
@override @override
State<UserSecurityPage> createState() => _UserSecurityPageState(); State<UserSecurityPage> createState() => _UserSecurityPageState();
...@@ -23,7 +20,7 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -23,7 +20,7 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
body: Column( body: Column(
children: [ children: [
Container( Container(
margin: EdgeInsets.symmetric(vertical: 10.w,horizontal: 10.w), margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
color: Colors.white, color: Colors.white,
...@@ -38,23 +35,26 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -38,23 +35,26 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
), ),
child: Column( child: Column(
children: [ children: [
GestureDetector( GestureDetector(
onTap:(){ onTap: () {
context.pushNamed(Routes.changePhone); context.pushNamed(Routes.changePhone);
}, },
child: _buildItem(title: '修改手机号码', value: widget.model.phone??'') child: _buildItem(
), title: '修改手机号码', value: widget.model.phone ?? '')),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 10.w), margin: EdgeInsets.symmetric(horizontal: 10.w),
height: 0.5.w, height: 0.5.w,
color:Colours.cF0, color: Colours.cF0,
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
context.pushNamed(Routes.changePwd,extra: widget.model); context.pushNamed(Routes.changePwd, extra: widget.model);
}, },
child: _buildItem(title: '修改密码', value: widget.model.password.toString().isEmpty?'未设置':'') child: _buildItem(
), title: '修改密码',
value: widget.model.password.toString().isEmpty
? '未设置'
: '')),
], ],
), ),
), ),
...@@ -75,7 +75,7 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -75,7 +75,7 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
child: Column( child: Column(
children: [ children: [
GestureDetector( GestureDetector(
child: _buildItem(title: '账号注销', value: ''), child: _buildItem(title: '账号注销', value: ''),
onTap: () async { onTap: () async {
showDialog( showDialog(
context: context, context: context,
...@@ -84,41 +84,51 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -84,41 +84,51 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0.w), borderRadius: BorderRadius.circular(8.0.w),
), ),
contentPadding: EdgeInsets.zero, // 移除内容部分的内边距 contentPadding: EdgeInsets.zero,
content: Wrap(children: [ // 移除内容部分的内边距
Container( content: Wrap(
margin: EdgeInsets.only(top: 44.w, bottom: 29.w), // 调整上下间距 children: [
child: Center( Container(
child: Text( margin:
'确定注销账号吗', EdgeInsets.only(top: 44.w, bottom: 29.w),
style: TextStyle( // 调整上下间距
fontSize: 15.w, child: Center(
fontWeight: Fonts.medium, child: Text(
color: Colours.c3, '确定注销账号吗',
style: TextStyle(
fontSize: 15.w,
fontWeight: Fonts.medium,
color: Colours.c3,
),
), ),
), ),
), ),
), Container(
Container( height: 1.w, // 设置分割线的高度
height: 1.w, // 设置分割线的高 width: double.infinity, // 设置分割线的宽
width: double.infinity, // 设置分割线的宽度 color: Colours.cLine, // 设置分割线的颜色
color: Colours.cLine, // 设置分割线的颜色 ),
), ],
],), ),
// 去除操作按钮区域的内边距 // 去除操作按钮区域的内边距
actionsPadding: EdgeInsets.zero, actionsPadding: EdgeInsets.zero,
actions: <Widget>[ actions: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 或者使用MainAxisAlignment.spaceEvenly mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
child: const Text( child: Container(
'取消', width: 105.w,
style: TextStyle( color: Colours.cFF,
fontSize: 12, alignment: Alignment.center,
fontWeight: Fonts.medium, child: const Text(
color: Colours.c6, '取消',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.c6,
),
), ),
), ),
), ),
...@@ -130,36 +140,35 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -130,36 +140,35 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
final result = await AccountAPI.delete(); final result = await AccountAPI.delete();
if (result){ if (result) {
CustomToast.loading(); CustomToast.loading();
await UserStore.to.logout(); await UserStore.to.logout();
CustomToast.dismiss(); CustomToast.dismiss();
if(context.mounted){ if (context.mounted) {
context.goNamed(Routes.splash); context.goNamed(Routes.splash);
} }
} }
}, },
child: const Text( child: Container(
'确定', width: 105.w,
style: TextStyle( color: Colours.cFF,
fontSize: 12, alignment: Alignment.center,
fontWeight: Fonts.medium, child: const Text(
color: Colours.cAB1941, '确定',
style: TextStyle(
fontSize: 12,
fontWeight: Fonts.medium,
color: Colours.cAB1941,
),
), ),
), ),
), ),
], ],
), ),
], ],
); );
}, },
); );
}, },
), ),
], ],
...@@ -170,27 +179,31 @@ class _UserSecurityPageState extends State<UserSecurityPage> { ...@@ -170,27 +179,31 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
); );
} }
Widget _buildItem({required String title,required String value}){ Widget _buildItem({required String title, required String value}) {
return Container( return Container(
margin: EdgeInsets.only(left: 15.w,right: 15.w), margin: EdgeInsets.only(left: 15.w, right: 15.w),
color: Colors.white, color: Colors.white,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () async{ onTap: () async {},
},
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height:45.w, height: 45.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text(title,style: TextStyle(fontSize: 13.w,height: 1.5, color: Colours.c3)), child: Text(title,
style: TextStyle(
fontSize: 13.w, height: 1.5, color: Colours.c3)),
), ),
), ),
Row( Row(
children: [ children: [
Text(value,style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c9),), Text(
value,
style:
TextStyle(fontSize: 13.w, height: 1.5, color: Colours.c9),
),
Gaps.hGaps10, Gaps.hGaps10,
Image.asset('assets/images/right_arrow.png') Image.asset('assets/images/right_arrow.png')
], ],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论