You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
3 weeks ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:get/get.dart';
|
||
|
import 'package:problem_check_system/modules/home/home_controller.dart';
|
||
|
|
||
|
class HomePage extends StatelessWidget {
|
||
|
const HomePage({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
// 获取控制器
|
||
|
final HomeController controller = Get.put(HomeController());
|
||
|
|
||
|
return Obx(
|
||
|
() => Scaffold(
|
||
|
body: controller.pages[controller.selectedIndex.value], // 根据状态显示页面
|
||
|
bottomNavigationBar: NavigationBar(
|
||
|
selectedIndex: controller.selectedIndex.value,
|
||
|
onDestinationSelected: controller.changeIndex, // 回调控制状态更新
|
||
|
destinations: const [
|
||
|
NavigationDestination(
|
||
|
icon: Icon(Icons.home_outlined),
|
||
|
selectedIcon: Icon(Icons.home),
|
||
|
label: '首页',
|
||
|
),
|
||
|
NavigationDestination(
|
||
|
icon: Icon(Icons.description_outlined),
|
||
|
selectedIcon: Icon(Icons.description),
|
||
|
label: '问题',
|
||
|
),
|
||
|
NavigationDestination(
|
||
|
icon: Icon(Icons.person_outline),
|
||
|
selectedIcon: Icon(Icons.person),
|
||
|
label: '我的',
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|