Browse Source

切换页面增加数据刷新

dev-2.0
王子贤 1 month ago
parent
commit
a542cc14c5
3 changed files with 10 additions and 4 deletions
  1. 7
      lib/pages/main/main_page.dart
  2. 5
      lib/pages/mine/mine_page.dart
  3. 2
      lib/widget/live/live_room_user_profile_dialog.dart

7
lib/pages/main/main_page.dart

@ -45,7 +45,7 @@ class _MainPageState extends State<MainPage> {
homePage = HomePage(); homePage = HomePage();
discoverPage = DiscoverPage(); discoverPage = DiscoverPage();
messagePage = MessagePage(); messagePage = MessagePage();
minePage = MinePage();
minePage = MinePage(key: pageBKey,);
// UserController并调用获取环信用户token的方法 // UserController并调用获取环信用户token的方法
final userController = Get.put(UserController()); final userController = Get.put(UserController());
@ -71,6 +71,8 @@ class _MainPageState extends State<MainPage> {
await RTMManager.instance.initialize(appId: '4c2ea9dcb4c5440593a418df0fdd512d', userId: userId ?? ''); await RTMManager.instance.initialize(appId: '4c2ea9dcb4c5440593a418df0fdd512d', userId: userId ?? '');
} }
final pageBKey = GlobalKey<MinePageState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DoubleTapToExitWidget( return DoubleTapToExitWidget(
@ -137,6 +139,9 @@ class _MainPageState extends State<MainPage> {
onTap: () { onTap: () {
currentIndex = index; currentIndex = index;
pageController.jumpToPage(index); pageController.jumpToPage(index);
if(index == 3){
pageBKey.currentState?.getUserCount();
}
}, },
); );
} }

5
lib/pages/mine/mine_page.dart

@ -25,10 +25,10 @@ class MinePage extends StatefulWidget {
const MinePage({super.key}); const MinePage({super.key});
@override @override
State<MinePage> createState() => _MinePageState();
State<MinePage> createState() => MinePageState();
} }
class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
late MineController controller; late MineController controller;
@ -43,6 +43,7 @@ class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
].obs; ].obs;
@override @override
void initState() { void initState() {
super.initState(); super.initState();

2
lib/widget/live/live_room_user_profile_dialog.dart

@ -45,7 +45,7 @@ void showUserProfileDialog(
children: [ children: [
SizedBox(width: 110.w,), SizedBox(width: 110.w,),
if(isHost) Container( if(isHost) Container(
width: 111.w,
width: 100.w,
height: 30.w, height: 30.w,
margin: EdgeInsets.only(right: 10.w), margin: EdgeInsets.only(right: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(

Loading…
Cancel
Save