From d62f15d88968a732b27eb0bb412d9d8c0a47eab0 Mon Sep 17 00:00:00 2001 From: Jeremie Corpinot Date: Sat, 3 Apr 2021 21:03:57 +0200 Subject: [PATCH] =?UTF-8?q?=E2=98=9D=EF=B8=8F=20Update=20deprecated=20code?= =?UTF-8?q?=20(#136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/widgets/raw_editor.dart | 6 +++++- lib/widgets/text_selection.dart | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/widgets/raw_editor.dart b/lib/widgets/raw_editor.dart index 6a24f39c..eac1cbcf 100644 --- a/lib/widgets/raw_editor.dart +++ b/lib/widgets/raw_editor.dart @@ -1029,7 +1029,7 @@ class RawEditorState extends EditorState } @override - void hideToolbar() { + void hideToolbar([bool hideHandles = true]) { if (getSelectionOverlay()?.toolbar != null) { getSelectionOverlay()?.hideToolbar(); } @@ -1131,6 +1131,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 8aa29d25..f223ef00 100644 --- a/lib/widgets/text_selection.dart +++ b/lib/widgets/text_selection.dart @@ -155,8 +155,12 @@ class EditorTextSelectionOverlay { default: throw 'Invalid position'; } - selectionDelegate.textEditingValue = - value.copyWith(selection: newSelection, composing: TextRange.empty); + + selectionDelegate.userUpdateTextEditingValue( + value.copyWith(selection: newSelection, composing: TextRange.empty), + SelectionChangedCause.drag, + ); + selectionDelegate.bringIntoView(textPosition); }