flutter_typeahead icon indicating copy to clipboard operation
flutter_typeahead copied to clipboard

Keyboard is Automatically Dismissed When Tapping on Text Box

Open luigi741 opened this issue 4 years ago • 5 comments

As the title states, the text box is immediately dismissing the keyboard, which doesn't allow you to type anything. I am only encountering this issue with Android v11.0 on a Galaxy Note10+. I just upgraded my device from v10.0 to v11.0 and saw this bug. I then tested on an older device (Galaxy S8 running Android v9.0) and it works just fine. I'm on Flutter v1.22.5 currently.

I also tried to add resizeToAvoidBottomInset: false to the Scaffold() widget that it is in to prevent resize, but it still isn't working properly. Does anyone know what is causing this issue? Thanks ahead in advance for any suggestions and replies.

Here's my flutter doctor -v output (Android Studio does have the Dart and Flutter plugins installed even though it says they aren't in the output):

[✓] Flutter (Channel unknown, 1.22.5, on macOS 11.0.1 20B29 darwin-x64, locale
    en-US)
    • Flutter version 1.22.5 at /Users/luigi/Source/flutter
    • Framework revision 7891006299 (6 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/luigi/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/luigi/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/luigi/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.


[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Connected device (3 available)
    • SM N975U (mobile) • RF8MA3EGJLA • android-arm64  • Android 11 (API 30)
    • Web Server (web)  • web-server  • web-javascript • Flutter Tools
    • Chrome (web)      • chrome      • web-javascript • Google Chrome
      87.0.4280.141

luigi741 avatar Jan 19 '21 19:01 luigi741

The same on Flutter 1.22.1 and lib versions 1.9.0-2.0.0

Vitaliy-Svinchyak avatar Feb 25 '21 10:02 Vitaliy-Svinchyak

The way I fixed it: hideSuggestionsOnKeyboardHide: false

Vitaliy-Svinchyak avatar Feb 26 '21 09:02 Vitaliy-Svinchyak

I fixed this by setting keepSuggestionsOnSuggestionSelected to true

rpekarek avatar Apr 12 '21 16:04 rpekarek

Any workaround for this problem? i've got same problem too when open the web from mobile device, my device is android 11

raymondddenny avatar Aug 04 '21 10:08 raymondddenny

Any workaround for this problem? I've got the same problem too when open the web from a mobile device, my device is android 11

I'm using this package for flutter web and I got a problem keyboard to disappear when using from a mobile device.

But I've fixed the problem, the way I fixed it by add static in front of my Global Key and put it above the build function.

`static final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();

@override Widget build(BuildContext context) {.`

Hope it can help others that encountered the same problem

raymondddenny avatar Aug 06 '21 01:08 raymondddenny