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.
22 lines
673 B
22 lines
673 B
2 weeks ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:get/get.dart';
|
||
|
import 'package:problem_check_system/modules/my/views/my_page.dart';
|
||
|
import 'package:problem_check_system/modules/problem/views/problem_page.dart';
|
||
|
|
||
|
class HomeController extends GetxController {
|
||
|
// 使用 Rx 类型管理响应式状态
|
||
|
var selectedIndex = 0.obs;
|
||
|
|
||
|
// 页面列表
|
||
|
final List<Widget> pages = [
|
||
|
const Center(child: Text('首页内容')),
|
||
|
const ProblemPage(), // 使用 const 确保子页面不会频繁重建
|
||
|
const MyPage(),
|
||
|
];
|
||
|
|
||
|
// 改变选中索引,这个方法将由 NavigationBar 调用
|
||
|
void changeIndex(int index) {
|
||
|
selectedIndex.value = index;
|
||
|
}
|
||
|
}
|