feat(app): EditorPage 读取 template 参数 — 模板选择框架

This commit is contained in:
iven
2026-06-01 21:41:53 +08:00
parent db881c25a0
commit 6378da055f
2 changed files with 48 additions and 28 deletions

View File

@@ -29,8 +29,9 @@ import '../widgets/sticker_picker_sheet.dart';
/// 手账编辑器页面
class EditorPage extends StatelessWidget {
final String? journalId;
final String? templateId;
const EditorPage({super.key, this.journalId});
const EditorPage({super.key, this.journalId, this.templateId});
@override
Widget build(BuildContext context) {
@@ -53,6 +54,7 @@ class EditorPage extends StatelessWidget {
),
child: _EditorView(
journalId: journalId,
templateId: templateId,
onSaveComplete: () {
if (context.canPop()) {
context.pop();
@@ -154,9 +156,10 @@ class EditorPage extends StatelessWidget {
class _EditorView extends StatelessWidget {
final String? journalId;
final String? templateId;
final VoidCallback onSaveComplete;
const _EditorView({this.journalId, required this.onSaveComplete});
const _EditorView({this.journalId, this.templateId, required this.onSaveComplete});
@override
Widget build(BuildContext context) {
@@ -227,7 +230,11 @@ class _EditorView extends StatelessWidget {
// 日记标题
Expanded(
child: Text(
journalId != null ? '编辑日记' : '新建日记',
journalId != null
? '编辑日记'
: templateId != null
? '从模板新建'
: '新建日记',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),