Browse Source

个人信息刷新

ff_new
w-R 3 years ago
parent
commit
e823db7b27
  1. 2
      lib/community/community_view/community_dynamic.dart
  2. 39
      lib/mine/mine_page.dart

2
lib/community/community_view/community_dynamic.dart

@ -335,6 +335,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: MImage(
subjectInfo.images[0],
fit: BoxFit.cover,
radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
errorSrc: "assets/image/default_2_1.png",
@ -365,6 +366,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
subjectInfo.images[position],
fit: BoxFit.cover,
aspectRatio: 1,
radius: BorderRadius.circular(1),
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),

39
lib/mine/mine_page.dart

@ -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(

Loading…
Cancel
Save