import 'package:cs_resources/generated/assets.dart'; import 'package:flutter/cupertino.dart'; import 'package:plugin_platform/engine/toast/toast_engine.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:shared/utils/log_utils.dart'; import 'package:auto_route/auto_route.dart'; import 'my_following_page.dart'; import 'my_following_state.dart'; part 'my_following_vm.g.dart'; @riverpod class MyFollowingVm extends _$MyFollowingVm { MyFollowingState initState() { return MyFollowingState(); } @override MyFollowingState build(){ final state = initState(); Log.d("--------------------------build---------------------"); return state; } tabsRouterChange(){ Log.d("----tabsRouterChange---${myFollowingPageTabsRouterKey.currentState?.controller?.activeIndex}-"); state = state.copyWith(currentPageViewIdx: myFollowingPageTabsRouterKey.currentState?.controller?.activeIndex ?? 0); } // 切换tab handlerChangeTab(int tabIndex, TabsRouter? tabsRouter,) { tabsRouter = (tabsRouter?? myFollowingPageTabsRouterKey.currentState?.controller)!; tabsRouter.setActiveIndex(tabIndex); } setCurrentTabIndex(int activeTabIdx){ state = state.copyWith( activeTabIdx: activeTabIdx, ); } updateMyFollowingTabsNum(String code, int num, int activeTabIdx){ if(code == 'followerCount'){ state = state.copyWith( followerCount: num, activeTabIdx: activeTabIdx, ); } else if(code == 'followCount'){ state = state.copyWith( followCount: num, activeTabIdx: activeTabIdx, ); } } }