From 3511a93f66b55a844d5e1fa91e0ca1337bc50cbe Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 4 Aug 2021 09:43:33 +0800 Subject: [PATCH] mine --- lib/mine/mine_page.dart | 65 +++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 4e565ac0..783f47e0 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -44,7 +44,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { SmartDialog.show( widget: LoginTips( click: () { - SharedPreferences.getInstance().then((value) => value..setString("token", "")); + SharedPreferences.getInstance() + .then((value) => value..setString("token", "")); Navigator.of(context) .pushNamed('/router/login_page', arguments: {"login": "login"}); }, @@ -73,19 +74,19 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { refreshUserInfo(); } }); - } refreshUserInfo() { - if(mounted) + if (mounted) SharedPreferences.getInstance().then( - (value) => - { + (value) => { apiService = ApiService(Dio(), context: context, token: value.getString('token'), showLoading: false), - if (value.containsKey('user') && value.getString('user') != null && value.getString('user') != "") + if (value.containsKey('user') && + value.getString('user') != null && + value.getString('user') != "") { userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), }, @@ -99,9 +100,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { List ranks = []; queryUserInfo() async { - SmartDialog.showLoading(msg: S - .of(context) - .zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); BaseData rankData = await apiService.rankList(); if (rankData != null && rankData.isSuccess) { ranks.clear(); @@ -122,8 +121,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { 1); } SharedPreferences.getInstance().then( - (value) => - { + (value) => { value.setString('user', jsonEncode(baseDate.data)), }, ); @@ -160,7 +158,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { Column( children: [ Container( - margin: EdgeInsets.only(bottom: 8.h,right: 16.w), + margin: EdgeInsets.only(bottom: 8.h, right: 16.w), alignment: Alignment.centerRight, child: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -187,7 +185,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { onTap: _toUserInfo, child: mineView(), ), - SizedBox(height: 22.h,), + SizedBox( + height: 22.h, + ), GestureDetector( onTap: () { SharedPreferences.getInstance().then((value) { @@ -200,7 +200,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { '/router/mine_vip_level_page', arguments: { "rankLevel": rankLevel, - "createTime": (userinfo != null) ? "${userinfo.createTime}" : "", + "createTime": (userinfo != null) + ? "${userinfo.createTime}" + : "", "points": (userinfo != null) ? int.tryParse(userinfo.points) : 0, @@ -214,11 +216,11 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ? int.tryParse(userinfo.points) : 0, rankMax: (userinfo != null && - userinfo.memberRankVo != null) + userinfo.memberRankVo != null) ? userinfo.memberRankVo.rankOrigin : 0, createTime: - (userinfo != null) ? userinfo.createTime : "", + (userinfo != null) ? userinfo.createTime : "", ), ), orderOrCard(), @@ -266,9 +268,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { mainAxisSize: MainAxisSize.min, children: [ Text( - S - .of(context) - .ninyouyigedingdanyaolingqu, + S.of(context).ninyouyigedingdanyaolingqu, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 12.sp, @@ -341,9 +341,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .wodeqianbao, + S.of(context).wodeqianbao, "assets/image/icon_mine_wallet.png", ), ), @@ -360,9 +358,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .duihuanlishi, + S.of(context).duihuanlishi, "assets/image/icon_mine_records_of_consumption.png", ), ), @@ -378,9 +374,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .lingquanzhongxin, + S.of(context).lingquanzhongxin, "assets/image/icon_mine_invoice_assistant.png", ), ), @@ -396,8 +390,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S.of(context) - .guanlidizhi, + S.of(context).guanlidizhi, "assets/image/icon_location_address.png", ), ), @@ -406,9 +399,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { Navigator.of(context).pushNamed('/router/setting_page'); }, child: mineItem( - S - .of(context) - .shezhi, + S.of(context).shezhi, "assets/image/icon_mine_setting.png", ), ), @@ -503,9 +494,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { width: 12.w, ), Text( - S - .of(context) - .kaquan, + S.of(context).kaquan, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, @@ -548,9 +537,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { width: 12.w, ), Text( - S - .of(context) - .dingdan, + S.of(context).dingdan, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp,