This commit is contained in:
2026-09-23 15:33:59 +08:00
parent e4cdfbc42f
commit a83cda63f5
24 changed files with 874 additions and 81 deletions
+34 -9
View File
@@ -3,11 +3,20 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../providers/auth_provider.dart';
import '../add/add_page.dart';
import '../home/home_page.dart';
import '../assistant/assistant_page.dart';
import '../home/dashboard_page.dart';
import '../login/login_page.dart';
import '../mine/mine_page.dart';
import '../statistics/statistics_page.dart';
/// 底部导航的四个 Tab 是四个「角色」,不是四个功能:
///
/// 首页 = 模块目录(卡片由 core/module/app_module.dart 生成)
/// 记录 = 全局录入入口
/// 助手 = AI(阶段 B 接入,现在是占位页)
/// 我的 = 账号、模块管理、设置
///
/// **具体模块不进 Tab** —— 记账、笔记都从首页卡片进。
/// 代价是打开 App 多一次点击才能看到账单,换来的是「以后加模块不用改这里」。
class MainShell extends ConsumerStatefulWidget {
const MainShell({super.key});
@@ -38,12 +47,12 @@ class _MainShellState extends ConsumerState<MainShell> {
@override
Widget build(BuildContext context) {
// IndexedStack 保证四个页面常驻:写操作后首页/统计的数据失效能立即重取,
// IndexedStack 保证四个页面常驻:写操作后各页的数据失效能立即重取,
// 用户切回时看到的就是最新数据。
const pages = [
HomePage(),
DashboardPage(),
AddPage(),
StatisticsPage(),
AssistantPage(),
MinePage(),
];
return Scaffold(
@@ -54,10 +63,26 @@ class _MainShellState extends ConsumerState<MainShell> {
backgroundColor: Colors.white,
indicatorColor: const Color(0x33C8956E),
destinations: const [
NavigationDestination(icon: Icon(Icons.home_outlined), selectedIcon: Icon(Icons.home), label: '首页'),
NavigationDestination(icon: Icon(Icons.add_circle_outline), selectedIcon: Icon(Icons.add_circle), label: '记账'),
NavigationDestination(icon: Icon(Icons.bar_chart_outlined), selectedIcon: Icon(Icons.bar_chart), label: '统计'),
NavigationDestination(icon: Icon(Icons.person_outline), selectedIcon: Icon(Icons.person), label: '我的'),
NavigationDestination(
icon: Icon(Icons.home_outlined),
selectedIcon: Icon(Icons.home),
label: '首页',
),
NavigationDestination(
icon: Icon(Icons.add_circle_outline),
selectedIcon: Icon(Icons.add_circle),
label: '记录',
),
NavigationDestination(
icon: Icon(Icons.auto_awesome_outlined),
selectedIcon: Icon(Icons.auto_awesome),
label: '助手',
),
NavigationDestination(
icon: Icon(Icons.person_outline),
selectedIcon: Icon(Icons.person),
label: '我的',
),
],
),
);