From db881c25a0dd266412a7fa8527bb01a1c89f928a Mon Sep 17 00:00:00 2001 From: iven Date: Mon, 1 Jun 2026 21:38:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(app):=20=E9=9B=86=E6=88=90=E8=B4=B4?= =?UTF-8?q?=E7=BA=B8=E9=80=89=E6=8B=A9=E5=88=B0=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=20=E2=80=94=20=E5=BA=95=E9=83=A8=E9=9D=A2=E6=9D=BF=20+=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=94=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/editor/views/editor_page.dart | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/lib/features/editor/views/editor_page.dart b/app/lib/features/editor/views/editor_page.dart index c2f2091..7cdec9c 100644 --- a/app/lib/features/editor/views/editor_page.dart +++ b/app/lib/features/editor/views/editor_page.dart @@ -24,6 +24,7 @@ import '../widgets/draggable_element.dart'; import '../widgets/editor_toolbar.dart'; import '../widgets/text_input_overlay.dart'; import '../widgets/image_picker_handler.dart'; +import '../widgets/sticker_picker_sheet.dart'; /// 手账编辑器页面 class EditorPage extends StatelessWidget { @@ -269,6 +270,46 @@ class _EditorStack extends StatefulWidget { } class _EditorStackState extends State<_EditorStack> { + EditorTool? _lastTool; + + @override + void didUpdateWidget(covariant _EditorStack oldWidget) { + super.didUpdateWidget(oldWidget); + final currentTool = widget.state.activeTool; + + // 贴纸工具刚被激活时弹出底部面板(防止重复弹窗) + if (currentTool == EditorTool.sticker && _lastTool != EditorTool.sticker) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) _showStickerPicker(); + }); + } + _lastTool = currentTool; + } + + /// 显示贴纸选择底部面板 + void _showStickerPicker() { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (_) => StickerPickerSheet( + onStickerSelected: (emoji) { + final center = Offset( + MediaQuery.of(context).size.width / 2 - 24, + MediaQuery.of(context).size.height / 3, + ); + context.read().add(ElementAdded( + JournalElement.createSticker( + journalId: widget.journalId ?? '', + emoji: emoji, + position: center, + ), + )); + context.read().add(ToolChanged(EditorTool.select)); + }, + ), + ); + } + @override Widget build(BuildContext context) { final state = widget.state;