55 lines
1.6 KiB
Dart
Raw Permalink Normal View History

import 'dart:ffi';
2025-08-27 18:20:37 +08:00
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';
2025-08-27 18:20:37 +08:00
import 'main_controller.dart';
class MainView extends GetView<MainController> {
const MainView({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
key: controller.scaffoldKey, // 添加这一行!
2025-08-27 18:20:37 +08:00
// 使用 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,
2025-10-14 13:53:01 +08:00
// 选中时的颜色
fixedColor: Colors.blue,
// 未选中时的颜色
unselectedItemColor: Colors.grey,
2025-08-27 18:20:37 +08:00
),
),
drawer: Obx(
() => MainLeftDrawerWidget(
teamList: controller.myTeamList,
selectedTeam: controller.selectedTeam.value,
onTeamSelected: (team) {
2025-09-12 10:35:07 +08:00
controller.requestChangeCurrentTeam(team);
},
onRefreshList: () {
controller.requestAllTeamInfoList();
},
),
),
2025-08-27 18:20:37 +08:00
);
}
}