Skip to content

Commit 9071a39

Browse files
rafaelringcomigor
authored andcommitted
Fix keyboard not showing for targetSdk 28 (flutter#6985)
After bumping the targetSdk of Flutter apps to 28, the keyboard doesn't open anymore when inputting text on an Android Pie devices. The problem is caused by a change on the way the focus in handled: when the call `mImm.showSoftInput(view, 0);` is made, the currently focused view is the `DecorView` from the `Activity` hosting Flutter but the passed view reference (`view` argument) is the `FlutterView`. As the `InputMethodManager` checks if both views are the same before showing the keyboard, it never appears because the `FlutterView` never has focus. As Flutter doesn't have any input views as far as the Android side is concerned, the focus should always stay on the `FlutterView` itself and thus, this PR changes the `TextInputPlugin` to focus on the `FlutterView` as soon as it's created, fixing the keyboard issue. Co-authored-by: Igor Borges <igorborges12@gmail.com>
1 parent 70c4456 commit 9071a39

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public InputConnection createInputConnection(FlutterView view, EditorInfo outAtt
167167
}
168168

169169
private void showTextInput(FlutterView view) {
170+
view.requestFocus();
170171
mImm.showSoftInput(view, 0);
171172
}
172173

0 commit comments

Comments
 (0)