feat(app): EditorPage 顶栏添加评语入口 — 仅已有日记显示
- 添加评语图标按钮(仅 journalId != null 时显示) - 实现 _showComments 方法打开 CommentListSheet - 补充 api_client + comment_list_sheet imports
This commit is contained in:
@@ -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<ApiClient>(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 格式化日期显示
|
||||
String _formatDate(EditorState state) {
|
||||
final now = DateTime.now();
|
||||
|
||||
Reference in New Issue
Block a user