import 'dart:ffi'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:starwork_flutter/base/app_logger.dart'; import 'package:starwork_flutter/views/main/widget/main_left_drawer_widget.dart'; import 'main_controller.dart'; class MainView extends GetView { const MainView({super.key}); @override Widget build(BuildContext context) { return Scaffold( key: controller.scaffoldKey, // 添加这一行! // 使用 Obx 响应 currentIndex 的变化 body: Obx( () => IndexedStack( index: controller.currentIndex.value, children: controller.pages, ), ), bottomNavigationBar: Obx( () => BottomNavigationBar( currentIndex: controller.currentIndex.value, onTap: (index) => controller.changeIndex(index), items: controller.bottomNavItems, type: BottomNavigationBarType.fixed, // 多于3个时建议 fixed selectedFontSize: 12.sp, unselectedFontSize: 12.sp, // 选中时的颜色 fixedColor: Colors.blue, // 未选中时的颜色 unselectedItemColor: Colors.grey, ), ), drawer: Obx( () => MainLeftDrawerWidget( teamList: controller.myTeamList, selectedTeam: controller.selectedTeam.value, onTeamSelected: (team) { controller.requestChangeCurrentTeam(team); }, onRefreshList: () { controller.requestAllTeamInfoList(); }, ), ), ); } }