From 387669e3ffbddc3dd5766aa5c48b18faabd620f2 Mon Sep 17 00:00:00 2001 From: Xin Yao Date: Sun, 25 Apr 2021 09:53:49 -0700 Subject: [PATCH] Support flutter dev/master channel --- lib/widgets/raw_editor.dart | 6 +++++- lib/widgets/text_selection.dart | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/widgets/raw_editor.dart b/lib/widgets/raw_editor.dart index 35e3aa68..198c0f8e 100644 --- a/lib/widgets/raw_editor.dart +++ b/lib/widgets/raw_editor.dart @@ -1033,7 +1033,7 @@ class RawEditorState extends EditorState } @override - void hideToolbar() { + void hideToolbar([bool hideHandles = true]) { if (getSelectionOverlay()?.toolbar != null) { getSelectionOverlay()?.hideToolbar(); } @@ -1135,6 +1135,10 @@ class RawEditorState extends EditorState closeConnectionIfNeeded(); } } + + @override + void userUpdateTextEditingValue( + TextEditingValue value, SelectionChangedCause cause) {} } class _Editor extends MultiChildRenderObjectWidget { diff --git a/lib/widgets/text_selection.dart b/lib/widgets/text_selection.dart index a8748de1..c882ae6f 100644 --- a/lib/widgets/text_selection.dart +++ b/lib/widgets/text_selection.dart @@ -156,10 +156,13 @@ class EditorTextSelectionOverlay { default: throw 'Invalid position'; } - selectionDelegate - ..textEditingValue = - value.copyWith(selection: newSelection, composing: TextRange.empty) - ..bringIntoView(textPosition); + + selectionDelegate.userUpdateTextEditingValue( + value.copyWith(selection: newSelection, composing: TextRange.empty), + SelectionChangedCause.drag, + ); + + selectionDelegate.bringIntoView(textPosition); } Widget _buildToolbar(BuildContext context) {