Browse Source

mine

null_safety
fmk 4 years ago
parent
commit
3511a93f66
  1. 65
      lib/mine/mine_page.dart

65
lib/mine/mine_page.dart

@ -44,7 +44,8 @@ class _MinePage extends State<MinePage> 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<MinePage> 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<MinePage> with AutomaticKeepAliveClientMixin {
List<Rank> 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<MinePage> with AutomaticKeepAliveClientMixin {
1);
}
SharedPreferences.getInstance().then(
(value) =>
{
(value) => {
value.setString('user', jsonEncode(baseDate.data)),
},
);
@ -160,7 +158,7 @@ class _MinePage extends State<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> 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<MinePage> with AutomaticKeepAliveClientMixin {
width: 12.w,
),
Text(
S
.of(context)
.dingdan,
S.of(context).dingdan,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,

Loading…
Cancel
Save