mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
## Description This PR fixes an issue where keystrokes aren't received on Android devices with physical keyboards (e.g. rugged Zebra devices) when `keyboardType` is set to `TextInputType.none` on a `TextField`. The logic in `setTextInputClient` and `canShowTextInput` created an `inputTarget` with `InputTarget.Type.NO_TARGET` which caused the [input connection to short circuit](https://github.com/flutter/engine/blob/main/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java#L296) and not be established. Bug introduction PR: https://github.com/flutter/engine/pull/26585 ## Related Issue https://github.com/flutter/flutter/issues/89983 ## Unit Test Notes - The existing `showTextInput_textInputTypeNone()` stays green after update. - `inputConnection_textInputTypeNone()` updated to `assertNotNull`. I would make this more specific, but this is my first venture into the Flutter engine and don't know enough about those connection attributes. ## Demo Video below with Zebra MC9300 device. This issue can also be reproduced in a standard android emulator. Simply add a `TextField`, configure `keyboardType` to be `TextInputType.none` and attempt to enter text after running and giving focus to textfield. Before https://github.com/flutter/engine/assets/1988098/348ca061-b8b9-4483-956e-0732c1238207 After https://github.com/flutter/engine/assets/1988098/b65c7251-59b4-4c73-9b85-7ac03f47a7e4 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing.
Description
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
androidapp-frameworkcross-platformdartdart-platformdesktopflutterflutter-packagefuchsiaioslinux-desktopmacosmaterial-designmobilemobile-developmentskiawebweb-frameworkwindows
2.5 GiB
Languages
Dart
75%
C++
16.5%
Objective-C++
2.9%
Java
2.8%
Objective-C
0.7%
Other
1.9%