|
|
|
@ -7,9 +7,7 @@ import 'package:huixiang/generated/l10n.dart';
|
|
|
|
|
import 'package:huixiang/main.dart'; |
|
|
|
|
import 'package:huixiang/mine/mine_view/mine_order.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/comunity_comment.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/rank.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/sign_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/social_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
@ -34,7 +32,7 @@ class MinePage extends StatefulWidget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin { |
|
|
|
|
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin ,WidgetsBindingObserver{ |
|
|
|
|
ApiService apiService; |
|
|
|
|
UserInfo userInfo; |
|
|
|
|
List<Rank> ranks = []; |
|
|
|
@ -55,12 +53,31 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
|
super.dispose(); |
|
|
|
|
if (_refreshController != null) _refreshController.dispose(); |
|
|
|
|
if (_refreshController != null) |
|
|
|
|
_refreshController.dispose(); |
|
|
|
|
WidgetsBinding.instance.removeObserver(this); //销毁观察者 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
|
print("-didChangeAppLifecycleState-" + state.toString()); |
|
|
|
|
switch (state) { |
|
|
|
|
case AppLifecycleState.inactive: // 处于这种状态的应用程序应该假设它们可能在任何时候暂停。 |
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.resumed: //从后台切换前台,界面可见 |
|
|
|
|
querySocialInfo(); |
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.paused: // 界面不可见,后台 |
|
|
|
|
break; |
|
|
|
|
case AppLifecycleState.detached: // APP结束时调用 |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
WidgetsBinding.instance.addObserver(this); |
|
|
|
|
querySocialInfo(); |
|
|
|
|
|
|
|
|
|
eventBus.on<EventType>().listen((event) { |
|
|
|
@ -117,6 +134,11 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_onRefresh(){ |
|
|
|
|
queryUserInfo(); |
|
|
|
|
querySocialInfo(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///个人社交信息(粉丝/关注数量/成就数量) |
|
|
|
|
querySocialInfo() async { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
@ -128,9 +150,12 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
BaseData<SocialInfo> baseData = |
|
|
|
|
await apiService.socialInfo().catchError((onError) {}); |
|
|
|
|
await apiService.socialInfo().catchError((onError) { |
|
|
|
|
_refreshController.refreshFailed(); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
infoNumber = baseData.data; |
|
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
|
} |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
} |
|
|
|
@ -150,7 +175,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
|
header: MyHeader(), |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
onRefresh: () { |
|
|
|
|
setState(() {}); |
|
|
|
|
setState(() { |
|
|
|
|
_onRefresh(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
child: Container( |
|
|
|
|