Browse Source

mine

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

61
lib/mine/mine_page.dart

@ -44,7 +44,8 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
SmartDialog.show( SmartDialog.show(
widget: LoginTips( widget: LoginTips(
click: () { click: () {
SharedPreferences.getInstance().then((value) => value..setString("token", "")); SharedPreferences.getInstance()
.then((value) => value..setString("token", ""));
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/login_page', arguments: {"login": "login"}); .pushNamed('/router/login_page', arguments: {"login": "login"});
}, },
@ -73,19 +74,19 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
refreshUserInfo(); refreshUserInfo();
} }
}); });
} }
refreshUserInfo() { refreshUserInfo() {
if(mounted) if (mounted)
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => (value) => {
{
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
context: context, context: context,
token: value.getString('token'), token: value.getString('token'),
showLoading: false), 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'))), userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))),
}, },
@ -99,9 +100,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
List<Rank> ranks = []; List<Rank> ranks = [];
queryUserInfo() async { queryUserInfo() async {
SmartDialog.showLoading(msg: S SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai);
.of(context)
.zhengzaijiazai);
BaseData rankData = await apiService.rankList(); BaseData rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) { if (rankData != null && rankData.isSuccess) {
ranks.clear(); ranks.clear();
@ -122,8 +121,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
1); 1);
} }
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => (value) => {
{
value.setString('user', jsonEncode(baseDate.data)), value.setString('user', jsonEncode(baseDate.data)),
}, },
); );
@ -160,7 +158,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
Column( Column(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(bottom: 8.h,right: 16.w), margin: EdgeInsets.only(bottom: 8.h, right: 16.w),
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -187,7 +185,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
onTap: _toUserInfo, onTap: _toUserInfo,
child: mineView(), child: mineView(),
), ),
SizedBox(height: 22.h,), SizedBox(
height: 22.h,
),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
@ -200,7 +200,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
'/router/mine_vip_level_page', '/router/mine_vip_level_page',
arguments: { arguments: {
"rankLevel": rankLevel, "rankLevel": rankLevel,
"createTime": (userinfo != null) ? "${userinfo.createTime}" : "", "createTime": (userinfo != null)
? "${userinfo.createTime}"
: "",
"points": (userinfo != null) "points": (userinfo != null)
? int.tryParse(userinfo.points) ? int.tryParse(userinfo.points)
: 0, : 0,
@ -266,9 +268,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
S S.of(context).ninyouyigedingdanyaolingqu,
.of(context)
.ninyouyigedingdanyaolingqu,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12.sp, fontSize: 12.sp,
@ -341,9 +341,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
}); });
}, },
child: mineItem( child: mineItem(
S S.of(context).wodeqianbao,
.of(context)
.wodeqianbao,
"assets/image/icon_mine_wallet.png", "assets/image/icon_mine_wallet.png",
), ),
), ),
@ -360,9 +358,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
}); });
}, },
child: mineItem( child: mineItem(
S S.of(context).duihuanlishi,
.of(context)
.duihuanlishi,
"assets/image/icon_mine_records_of_consumption.png", "assets/image/icon_mine_records_of_consumption.png",
), ),
), ),
@ -378,9 +374,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
}); });
}, },
child: mineItem( child: mineItem(
S S.of(context).lingquanzhongxin,
.of(context)
.lingquanzhongxin,
"assets/image/icon_mine_invoice_assistant.png", "assets/image/icon_mine_invoice_assistant.png",
), ),
), ),
@ -396,8 +390,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
}); });
}, },
child: mineItem( child: mineItem(
S.of(context) S.of(context).guanlidizhi,
.guanlidizhi,
"assets/image/icon_location_address.png", "assets/image/icon_location_address.png",
), ),
), ),
@ -406,9 +399,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
Navigator.of(context).pushNamed('/router/setting_page'); Navigator.of(context).pushNamed('/router/setting_page');
}, },
child: mineItem( child: mineItem(
S S.of(context).shezhi,
.of(context)
.shezhi,
"assets/image/icon_mine_setting.png", "assets/image/icon_mine_setting.png",
), ),
), ),
@ -503,9 +494,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
width: 12.w, width: 12.w,
), ),
Text( Text(
S S.of(context).kaquan,
.of(context)
.kaquan,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
@ -548,9 +537,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
width: 12.w, width: 12.w,
), ),
Text( Text(
S S.of(context).dingdan,
.of(context)
.dingdan,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,

Loading…
Cancel
Save