UI更新
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../pages/bill/bill_home_page.dart';
|
||||
import '../../pages/bill/widgets/bill_module_summary.dart';
|
||||
import '../../pages/note/note_list_page.dart';
|
||||
import '../../pages/note/widgets/note_module_summary.dart';
|
||||
|
||||
/// 一个功能模块要对外暴露的东西:它是谁、怎么打开自己。
|
||||
///
|
||||
/// 首页仪表盘的卡片网格、「我的」里的模块列表都从 [appModules] 生成 ——
|
||||
/// 新增一个模块 = 往列表里加一条 + 写这个模块的页面,
|
||||
/// 布局层(导航栏、首页、设置页)一行都不用改。
|
||||
@immutable
|
||||
class AppModule {
|
||||
const AppModule({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.blurb,
|
||||
required this.icon,
|
||||
required this.open,
|
||||
this.summary,
|
||||
});
|
||||
|
||||
/// 稳定标识。将来做「模块排序 / 开关 / AI 可读范围」时要靠它持久化。
|
||||
final String id;
|
||||
|
||||
/// 模块名,显示在卡片和列表上
|
||||
final String name;
|
||||
|
||||
/// 一句话说明,让用户在首页就能看懂这个模块是干什么的
|
||||
final String blurb;
|
||||
|
||||
/// 用 emoji 当图标 —— 和项目现有的卡片风格一致(笔记入口、预算提示都是 emoji)
|
||||
final String icon;
|
||||
|
||||
/// 打开模块入口页
|
||||
final WidgetBuilder open;
|
||||
|
||||
/// 首页卡片上的摘要。
|
||||
///
|
||||
/// 由模块自己提供,因为只有模块知道该摘要什么;返回 null 表示这个模块
|
||||
/// 暂时没有可显示的数据(卡片就只显示名字和说明)。
|
||||
final Widget Function(BuildContext context)? summary;
|
||||
}
|
||||
|
||||
/// 全部模块。**顺序 = 首页卡片顺序 = 「我的」里的列表顺序。**
|
||||
///
|
||||
/// 现在只有两个真模块。加「投资」「运动」「服务器」时照抄一条即可 ——
|
||||
/// 注意「记录」Tab 目前直接就是记账录入,等第二种记录类型出现时,
|
||||
/// 才需要在它上面加一层「选类型」。
|
||||
final List<AppModule> appModules = [
|
||||
AppModule(
|
||||
id: 'bill',
|
||||
name: '记账',
|
||||
blurb: '收支记录、统计与预算',
|
||||
icon: '💰',
|
||||
open: (_) => const BillHomePage(),
|
||||
summary: (_) => const BillModuleSummary(),
|
||||
),
|
||||
AppModule(
|
||||
id: 'note',
|
||||
name: '笔记',
|
||||
blurb: 'Markdown 知识库,随时查看和记录',
|
||||
icon: '📝',
|
||||
open: (_) => const NoteListPage(),
|
||||
summary: (_) => const NoteModuleSummary(),
|
||||
),
|
||||
];
|
||||
Reference in New Issue
Block a user