From 65c38a8d470228b8614e856296c3da2561d7b2d3 Mon Sep 17 00:00:00 2001 From: li3317 Date: Sat, 24 Dec 2022 01:28:57 -0500 Subject: [PATCH] Recalculate focus when showing keyboard --- CHANGELOG.md | 3 +++ lib/src/widgets/raw_editor.dart | 8 +++++++- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cacd97d..15832947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [6.1.8] +* Recalculate focus when showing keyboard. + # [6.1.7] * Add czech localizations. diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 8c9ea96a..ce10e84f 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -1073,8 +1073,14 @@ class RawEditorState extends EditorState return; } if (_hasFocus) { + final keyboardAlreadyShown = _keyboardVisible; openConnectionIfNeeded(); - _showCaretOnScreen(); + if (keyboardAlreadyShown) { + _showCaretOnScreen(); + } else { + /// delay 500 milliseconds for waiting keyboard show up + Future.delayed(const Duration(milliseconds: 500), _showCaretOnScreen); + } } else { widget.focusNode.requestFocus(); } diff --git a/pubspec.yaml b/pubspec.yaml index e7a4ba38..2e7a33f3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 6.1.7 +version: 6.1.8 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill