import 'package:domain/repository/profile_repository.dart'; import 'package:plugin_basic/provider/user_config/user_config_service.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:router/componentRouter/component_service_manager.dart'; import 'package:shared/utils/log_utils.dart'; import 'package:widgets/widget_export.dart'; part 'me_view_model.g.dart'; @riverpod class MeViewModel extends _$MeViewModel { late final ProfileRepository _profileRepository; @override void build() { _profileRepository = ref.read(profileRepositoryProvider); } // Refresh 控制器 final EasyRefreshController refreshController = EasyRefreshController( controlFinishRefresh: true, //允许刷新 controlFinishLoad: false, //允许加载 ); // Refresh 刷新事件 Future onRefresh() async { final result = await _profileRepository.fetchUserInfo(); if (result.isSuccess) { UserConfigService.getInstance().setUserInfo(result.data); } else { Log.e(result.errorMsg ?? "UnKnow Error"); } refreshController.finishRefresh(); } //去我的房产页面 void gotoMyEstatePage() { ComponentServiceManager().profileService.startMyEstatePage(); } //去我的家庭成员页面 void gotoMyHouseholdPage() { ComponentServiceManager().profileService.startMyHouseHoldPage(); } //去我的发布页面 void gotoMyPostPage() { // ToastEngine.show("去我的发布页面"); ComponentServiceManager().communityService.startMyPostsPage(); } //去设置页面 void gotoSettingPage() { ComponentServiceManager().profileService.startSettingPage(); } //我的关注Tab void gotoFollowingPage() { // ToastEngine.show("我的关注Tab"); ComponentServiceManager().communityService.startMyFollowPage(); } //我的粉丝Tab void gotoFollowerPage() { // ToastEngine.show("我的粉丝Tab"); ComponentServiceManager().communityService.startMyFollowerPage(); } //编辑附加信息 void gotoEditProfilePage() { ComponentServiceManager().profileService.startEditProfilePage(); } }