fix selection overlay for collapsed selection (#606)

pull/609/head
Andy Trand 3 years ago committed by GitHub
parent 8af6ddd58c
commit 24d3f7830d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      lib/src/widgets/raw_editor.dart
  2. 2
      lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart

@ -695,15 +695,13 @@ class RawEditorState extends EditorState
void _updateOrDisposeSelectionOverlayIfNeeded() { void _updateOrDisposeSelectionOverlayIfNeeded() {
if (_selectionOverlay != null) { if (_selectionOverlay != null) {
if (_hasFocus && !textEditingValue.selection.isCollapsed) { if (!_hasFocus) {
_selectionOverlay!.update(textEditingValue);
} else {
_selectionOverlay!.dispose(); _selectionOverlay!.dispose();
_selectionOverlay = null; _selectionOverlay = null;
} else if (!textEditingValue.selection.isCollapsed) {
_selectionOverlay!.update(textEditingValue);
} }
} else if (_hasFocus) { } else if (_hasFocus) {
_selectionOverlay?.hide();
_selectionOverlay = EditorTextSelectionOverlay( _selectionOverlay = EditorTextSelectionOverlay(
value: textEditingValue, value: textEditingValue,
context: context, context: context,

@ -306,7 +306,7 @@ mixin RawEditorStateTextInputClientMixin on EditorState
} }
final size = renderEditor.size; final size = renderEditor.size;
final transform = renderEditor.getTransformTo(null); final transform = renderEditor.getTransformTo(null);
_textInputConnection!.setEditableSizeAndTransform(size, transform); _textInputConnection?.setEditableSizeAndTransform(size, transform);
}); });
} }
} }

Loading…
Cancel
Save