diff --git a/lib/src/editor/block_component/base_component/widget/ignore_parent_gesture.dart b/lib/src/editor/block_component/base_component/widget/ignore_parent_gesture.dart index 9c3d2c092..35096c940 100644 --- a/lib/src/editor/block_component/base_component/widget/ignore_parent_gesture.dart +++ b/lib/src/editor/block_component/base_component/widget/ignore_parent_gesture.dart @@ -20,7 +20,6 @@ class IgnoreEditorSelectionGesture extends StatefulWidget { class _IgnoreEditorSelectionGestureState extends State { final key = Random(10000).toString(); - final FocusNode _focusNode = FocusNode(); late final SelectionGestureInterceptor interceptor; late final EditorState editorState = context.read(); @@ -50,12 +49,14 @@ class _IgnoreEditorSelectionGestureState @override Widget build(BuildContext context) { - return Focus( - focusNode: _focusNode, - onFocusChange: (value) { - // current has focus ,close editor - if (value) { - editorState.selection = null; + return Listener( + onPointerDown: (event) { + final renderObject = context.findRenderObject(); + // touch to clear + if (renderObject != null && renderObject is RenderBox) { + if (renderObject.paintBounds.contains(event.localPosition)) { + editorState.selection = null; + } } }, child: widget.child,