From 53eaf34ad95e497432ae28179227174c425829c1 Mon Sep 17 00:00:00 2001 From: Xin Yao Date: Fri, 2 Apr 2021 00:10:21 -0700 Subject: [PATCH] Revert change in openConnectionIfNeeded for readonly mode --- lib/widgets/raw_editor.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/widgets/raw_editor.dart b/lib/widgets/raw_editor.dart index 130af8b4..7dbd46ed 100644 --- a/lib/widgets/raw_editor.dart +++ b/lib/widgets/raw_editor.dart @@ -371,6 +371,10 @@ class RawEditorState extends EditorState _textInputConnection != null && _textInputConnection!.attached; void openConnectionIfNeeded() { + if (!shouldCreateInputConnection) { + return; + } + if (!hasConnection) { _lastKnownRemoteTextEditingValue = textEditingValue; _textInputConnection = TextInput.attach( @@ -388,11 +392,8 @@ class RawEditorState extends EditorState _textInputConnection!.setEditingState(_lastKnownRemoteTextEditingValue!); // _sentRemoteValues.add(_lastKnownRemoteTextEditingValue); } + _textInputConnection!.show(); - if (widget.readOnly) { - // temporary hack to dismiss keyboard - SystemChannels.textInput.invokeMethod('TextInput.hide'); - } } void closeConnectionIfNeeded() {