From d6c74098d24492f1589769cb633ae7c15e2ccc8d Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 22 Jul 2024 08:09:50 -0700 Subject: [PATCH] if magnifier removes toolbar, restore it when it is hidden (#2049) --- lib/src/editor/widgets/text/text_selection.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/src/editor/widgets/text/text_selection.dart b/lib/src/editor/widgets/text/text_selection.dart index fc527f5d..3e83d00e 100644 --- a/lib/src/editor/widgets/text/text_selection.dart +++ b/lib/src/editor/widgets/text/text_selection.dart @@ -181,6 +181,7 @@ class EditorTextSelectionOverlay { /// A copy/paste toolbar. OverlayEntry? toolbar; + bool _restoreToolbar = false; TextSelection get _selection => value.selection; @@ -411,8 +412,12 @@ class EditorTextSelectionOverlay { void _showMagnifier(MagnifierInfo initialMagnifierInfo) { // 隐藏toolbar if (toolbar != null) { + _restoreToolbar = true; hideToolbar(); + } else { + _restoreToolbar = false; } + // 更新 magnifierInfo _magnifierInfo.value = initialMagnifierInfo; @@ -456,6 +461,10 @@ class EditorTextSelectionOverlay { return; } _magnifierController.hide(); + if (_restoreToolbar) { + _restoreToolbar = false; + showToolbar(); + } } // build magnifier info