按下颤振后退按钮,不会在Android 10上隐藏键盘

时间:2020-09-27 16:42:58

标签: android flutter

通常,如果我们按“后退”按钮,键盘将隐藏,但是如本视频所示,当反复按“后退”按钮时,键盘不会被隐藏。但是在Android 7上的测试中,当我按下隐藏的键盘后退按钮时,它运行良好。

赞这个 https://user-images.githubusercontent.com/11581453/94370563-64b50480-0123-11eb-9329-4a52aaeb6aaa.gif

这是我的输入代码

TextFormField(
  validator: (e) {
    var message;
    if (e.isEmpty) {
      message = emailEmpty;
    }
    return message;
  },
  onSaved: (e) => email = e,
  decoration: InputDecoration(
    prefixIcon: Icon(
      Icons.email,
      color: Color(0xFF003d64),
    ),
    labelText: emailInput,
  ),
),

flutter doctor -v

[✓] Flutter (Channel beta, 1.22.0-12.1.pre, on Mac OS X 10.15.6 19G2021, locale en-ID)
    • Flutter version 1.22.0-12.1.pre at / Users / abedputra / Development / flutter
    • Framework revision 8b3760638a (12 days ago), 2020-09-15 17:47:13 -0700
    • Engine revision 4654fc6cf6
    Dart version 2.10.0 (build 2.10.0-110.3.beta)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at / Users / abedputra / Library / Android / sdk
    • Android-R platform, build-tools 29.0.3
    • 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 installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.9.3

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

[✓] Android Studio (version 4.0)
    • Android Studio at / Applications / Android Studio.app/Contents
    • Flutter plugin version 50.0.2-dev.1
    • Dart plugin version 193.7547
    Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (3 available)
    • K88 (mobile) 6acdf2f6 android-arm64 Android 7.1.1 (API 25)
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web) • chrome • web-javascript • Google Chrome 85.0.4183.121

2 个答案:

答案 0 :(得分:0)

已经在Flutter Github页面上修复了here

要解决此问题,请从 Beta 频道更改为稳定 Master 频道。

更新

Flutter在Beta O(n^2)(2020-10-01)发布了一个新版本,该问题已得到解决。

谢谢

答案 1 :(得分:-1)

尝试将dispose方法添加到您的类State(窗口小部件):

    @override
      void dispose() {
        // TODO: implement dispose
        super.dispose();
      }