|
|
|
@ -64,6 +64,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
super.initState(); |
|
|
|
|
refreshUserInfo(); |
|
|
|
|
eventBus.on<EventType>().listen((event) { |
|
|
|
|
print("EventType: Mine"); |
|
|
|
|
print("EventType: ${event.type}"); |
|
|
|
|
if (event.type < 3) { |
|
|
|
|
setState(() {}); |
|
|
|
@ -72,23 +73,25 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
refreshUserInfo(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
refreshUserInfo() { |
|
|
|
|
SharedPreferences.getInstance().then( |
|
|
|
|
(value) => |
|
|
|
|
{ |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString('token'), |
|
|
|
|
showLoading: false), |
|
|
|
|
if (value.containsKey('user')) |
|
|
|
|
{ |
|
|
|
|
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), |
|
|
|
|
}, |
|
|
|
|
queryUserInfo() |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
if(mounted) |
|
|
|
|
SharedPreferences.getInstance().then( |
|
|
|
|
(value) => |
|
|
|
|
{ |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString('token'), |
|
|
|
|
showLoading: false), |
|
|
|
|
if (value.containsKey('user') && value.getString('user') != null && value.getString('user') != "") |
|
|
|
|
{ |
|
|
|
|
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), |
|
|
|
|
}, |
|
|
|
|
queryUserInfo() |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UserInfo userinfo; |
|
|
|
|