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() {
if (_selectionOverlay != null) {
if (_hasFocus && !textEditingValue.selection.isCollapsed) {
_selectionOverlay!.update(textEditingValue);
} else {
if (!_hasFocus) {
_selectionOverlay!.dispose();
_selectionOverlay = null;
} else if (!textEditingValue.selection.isCollapsed) {
_selectionOverlay!.update(textEditingValue);
}
} else if (_hasFocus) {
_selectionOverlay?.hide();
_selectionOverlay = EditorTextSelectionOverlay(
value: textEditingValue,
context: context,

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

Loading…
Cancel
Save