From 9e53ca8555f46a6bda8fc1a72c8b9877c40db8cb Mon Sep 17 00:00:00 2001 From: iven Date: Tue, 2 Jun 2026 23:26:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(app):=20EditorPage=20=E9=A1=B6=E6=A0=8F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AF=AD=E5=85=A5=E5=8F=A3=20?= =?UTF-8?q?=E2=80=94=20=E4=BB=85=E5=B7=B2=E6=9C=89=E6=97=A5=E8=AE=B0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加评语图标按钮(仅 journalId != null 时显示) - 实现 _showComments 方法打开 CommentListSheet - 补充 api_client + comment_list_sheet imports --- .../features/editor/views/editor_page.dart | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/lib/features/editor/views/editor_page.dart b/app/lib/features/editor/views/editor_page.dart index 4c426de..6e92004 100644 --- a/app/lib/features/editor/views/editor_page.dart +++ b/app/lib/features/editor/views/editor_page.dart @@ -19,9 +19,11 @@ import '../../../data/models/journal_element.dart'; import '../../../data/models/journal_entry.dart' show JournalEntry, Mood; import '../../../data/repositories/journal_repository.dart'; import '../../../data/repositories/class_repository.dart'; +import '../../../data/remote/api_client.dart'; import '../../../data/services/sync_engine.dart'; import '../../auth/bloc/auth_bloc.dart'; import '../bloc/editor_bloc.dart'; +import '../widgets/comment_list_sheet.dart'; import '../widgets/handwriting_canvas.dart'; import '../widgets/stroke_model.dart'; import '../widgets/draggable_element.dart'; @@ -427,6 +429,13 @@ class _EditorViewState extends State<_EditorView> { onPressed: () => _showTagPanel(context, state), constraints: const BoxConstraints(minWidth: 36, minHeight: 36), ), + // 评语按钮(仅已有日记显示) + if (widget.journalId != null) + IconButton( + icon: const Icon(Icons.chat_bubble_outline_rounded, size: 18), + onPressed: () => _showComments(context), + constraints: const BoxConstraints(minWidth: 36, minHeight: 36), + ), // 完成/保存按钮 Padding( padding: const EdgeInsets.only(left: 4), @@ -464,6 +473,22 @@ class _EditorViewState extends State<_EditorView> { widget.onSaveComplete(); } + /// 显示评论列表 + void _showComments(BuildContext context) { + final journalId = widget.journalId; + if (journalId == null) return; + + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (_) => CommentListSheet( + journalId: journalId, + apiClient: context.read(), + ), + ); + } + /// 格式化日期显示 String _formatDate(EditorState state) { final now = DateTime.now();