Browse Source

ui 修改

null_safety
fmk 4 years ago
parent
commit
e4071b0323
  1. 1
      lib/home/points_mall_page.dart
  2. 5
      lib/mine/mine_page.dart

1
lib/home/points_mall_page.dart

@ -72,6 +72,7 @@ class _PointsMallPage extends State<PointsMallPage>
} }
refreshUserInfo() { refreshUserInfo() {
if(mounted)
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
client = ApiService(Dio(), client = ApiService(Dio(),
context: context, context: context,

5
lib/mine/mine_page.dart

@ -64,6 +64,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
super.initState(); super.initState();
refreshUserInfo(); refreshUserInfo();
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {
print("EventType: Mine");
print("EventType: ${event.type}"); print("EventType: ${event.type}");
if (event.type < 3) { if (event.type < 3) {
setState(() {}); setState(() {});
@ -72,9 +73,11 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
refreshUserInfo(); refreshUserInfo();
} }
}); });
} }
refreshUserInfo() { refreshUserInfo() {
if(mounted)
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => (value) =>
{ {
@ -82,7 +85,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
context: context, context: context,
token: value.getString('token'), token: value.getString('token'),
showLoading: false), showLoading: false),
if (value.containsKey('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'))),
}, },

Loading…
Cancel
Save