Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textfield obscureText interaction exception #140369

Open
ASooner opened this issue Dec 19, 2023 · 13 comments
Open

Textfield obscureText interaction exception #140369

ASooner opened this issue Dec 19, 2023 · 13 comments
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices e: OS-version specific Affects only some versions of the relevant operating system f: material design flutter/packages/flutter/material repository. P3 Issues that are less important to the Flutter project platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@ASooner
Copy link

ASooner commented Dec 19, 2023

Steps to reproduce

  1. First click on a textfield whose obscureText is false(true)
  2. Click again on a textfield whose obscureText is true (false)

Expected results

The keyboard should not disappear and reappear. It should directly determine the keyboard type and focus on the new textfield.

Actual results

The keyboard animation pops up and disappears abnormally. The cursor disappears and needs to be clicked again to focus.

Upgrading from 3.10.0 to 3.16.0 appears, in HarmonyOS 4,

Code sample

Code sample
class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text('Demo'),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
                key: Key('a'),
                keyboardType: TextInputType.numberWithOptions(signed: true),
                decoration: InputDecoration(hintText: ' a obscureText false')),
            TextField(
                key: Key('c'),
                keyboardType: TextInputType.text,
                obscureText: true,
                decoration: InputDecoration(hintText: ' c obscureText true')),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): Start long press for hw drag enhancement.
D/WebViewDragEnhancement( 6838): dragReset.
D/WebViewDragEnhancement( 6838): dragReset cacheSize = 0
I/InputMethodManager( 6838): Starting input: reason=APP_CALLED_RESTART_INPUT_API
W/HwRemoteInputMethodManager( 6838): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager( 6838): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
I/InputMethodManager( 6838): showSoftInput, displayId=-1,callers=android.view.inputmethod.InputMethodManager.showSoftInput:1785 android.view.inputmethod.InputMethodManager.showSoftInput:1723 io.flutter.plugin.editing.TextInputPlugin.showTextInput:401 io.flutter.plugin.editing.TextInputPlugin$2.show:102 
D/InputMethodManager( 6838): showSoftInput() view=io.flutter.embedding.android.FlutterView{fcfca67 VFE...... .F...... 0,0-1080,2340 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:false, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
I/AssistStructure( 6838): Flattened final assist data: 480 bytes, containing 1 windows, 3 views
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
D/InsetsController( 6838): ViewUI_insets show(ime(), fromIme=true)
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:true, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.16.0, on macOS 13.5.1 22G90 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.16.0 on channel stable at /Users/Baibinbu/fvm/versions/3.16.0
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.1/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/Baibinbu/fvm/versions/3.16.0. Consider adding /Users/Baibinbu/fvm/versions/3.16.0/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (5 weeks ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/Baibinbu/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_HOME = /Users/Baibinbu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3
@dam-ease dam-ease added the in triage Presently being triaged by the triage team label Dec 19, 2023
@dam-ease
Copy link

Thanks for filing this @ASooner.
I can't seem to reproduce this on my end on the latest versions of Flutter.
Can you check this out on the latest versions or share a screen record of the behaviour you see on your end.

Screen record

Simulator.Screen.Recording.-.iPhone.15.-.2023-12-19.at.10.58.48.mp4

Code Sample Used

import 'package:flutter/material.dart';

void main() {
  runApp(
    const MaterialApp(
      title: 'Scroll test',
      home: MyHomePage(),
      initialRoute: '/',
      debugShowCheckedModeBanner: false,
    ),
  );
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text('Demo'),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
                key: Key('a'),
                keyboardType: TextInputType.numberWithOptions(signed: true),
                decoration: InputDecoration(hintText: ' a obscureText false')),
            TextField(
                key: Key('c'),
                keyboardType: TextInputType.text,
                obscureText: true,
                decoration: InputDecoration(hintText: ' c obscureText true')),
          ],
        ),
      ),
    );
  }
}

flutter doctor -v

[!] Flutter (Channel stable, 3.16.4, on macOS 14.0 23A344 darwin-arm64, locale
    en-NG)
    • Flutter version 3.16.4 on channel stable at
      /Users/damilolaalimi/sdks/flutter
    ! Warning: `dart` on your path resolves to
      /opt/homebrew/Cellar/dart/3.1.5/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/damilolaalimi/sdks/flutter.
      Consider adding /Users/damilolaalimi/sdks/flutter/bin to the front of your
      path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2e9cb0aa71 (8 days ago), 2023-12-11 14:35:13 -0700
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/damilolaalimi/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/damilolaalimi/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[!] Android Studio (version unknown)
    • Android Studio at /Users/damilolaalimi/Downloads/Android Studio
      Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)

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

[✓] VS Code (version 1.83.1)
    • VS Code at /Users/damilolaalimi/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        •
      android-arm64  • Android 14 (API 34) (emulator)
    • Damilola’s iPhone (mobile)  • 00008110-001964480AE1801E            • ios
      • iOS 17.1.1 21B91
    • iPhone 15 (mobile)          • F17D2919-6D61-4295-8408-1719692FE958 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)             • macos                                •
      darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)                • chrome                               •
      web-javascript • Google Chrome 120.0.6099.109

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

@dam-ease dam-ease added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 19, 2023
@ASooner
Copy link
Author

ASooner commented Dec 20, 2023

Thanks for filing this @ASooner. I can't seem to reproduce this on my end on the latest versions of Flutter. Can you check this out on the latest versions or share a screen record of the behaviour you see on your end.

Screen record
Code Sample Used
flutter doctor -v

480.mov

I think this has something to do with the security keyboard. After 15 seconds, it becomes normal after turning off the security keyboard. The same problem was also found in VIVO (Android 12) phones

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 20, 2023
@dam-ease
Copy link

Thanks for your response @ASooner
Could this be specific to VIVO (Android 12) phones?
I can't reproduce on my Android device, can you please test this on another Android device or an Android device to see if this issue also persists there?

@dam-ease dam-ease added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 20, 2023
@ASooner
Copy link
Author

ASooner commented Dec 21, 2023

I debugged a Xiaomi 11 (Android 13) and did not find this problem. It seems that only some mobile phone systems have this problem. In vivo mobile phones, this problem occurs in Android 12 and Android 13. Huawei mobile phone system HarmonyOS 4 has this problem. HarmonyOS 3 no problem.
I can't test more phone models

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 21, 2023
@dam-ease dam-ease added a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices platform-android Android applications specifically f: material design flutter/packages/flutter/material repository. e: OS-version specific Affects only some versions of the relevant operating system team-android Owned by Android platform team team-design Owned by Design Languages team and removed in triage Presently being triaged by the triage team labels Dec 21, 2023
@flutter-triage-bot flutter-triage-bot bot removed team-android Owned by Android platform team team-design Owned by Design Languages team labels Dec 21, 2023
@flutter-triage-bot
Copy link

Issue is assigned to multiple teams (android, design). Please ensure the issue has only one team-* label at a time. Use fyi-* labels to have another team look at the issue without reassigning it.

@dam-ease dam-ease added the team-android Owned by Android platform team label Dec 21, 2023
@camsim99
Copy link
Contributor

camsim99 commented Jan 4, 2024

We're marking this issue as a P3 because we unfortunately do not have access to these devices. If someone in the community is able to work on this issue, we would definitely accept a fix!

@YYL1999
Copy link

YYL1999 commented Feb 21, 2024

We're marking this issue as a P3 because we unfortunately do not have access to these devices. If someone in the community is able to work on this issue, we would definitely accept a fix!

#143828 please fix it ,thanks!

@hrxiang
Copy link

hrxiang commented Feb 28, 2024

感谢您提交此文件@ASooner。我似乎无法在最新版本的 Flutter 上重现这一点。您可以在最新版本上查看一下吗?或者分享您在终端上看到的行为的屏幕记录。
屏幕记录
使用的代码示例
flutter doctor -v

480.mov
我认为这与安全键盘有关。15秒后,关闭安全键盘后恢复正常。VIVO(Android 12)手机也发现了同样的问题

Steps to reproduce

  1. First click on a textfield whose obscureText is false(true)
  2. Click again on a textfield whose obscureText is true (false)

Expected results

The keyboard should not disappear and reappear. It should directly determine the keyboard type and focus on the new textfield.

Actual results

The keyboard animation pops up and disappears abnormally. The cursor disappears and needs to be clicked again to focus.

Upgrading from 3.10.0 to 3.16.0 appears, in HarmonyOS 4,

Code sample

Code sample

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text('Demo'),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
                key: Key('a'),
                keyboardType: TextInputType.numberWithOptions(signed: true),
                decoration: InputDecoration(hintText: ' a obscureText false')),
            TextField(
                key: Key('c'),
                keyboardType: TextInputType.text,
                obscureText: true,
                decoration: InputDecoration(hintText: ' c obscureText true')),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs

Logs

D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): Start long press for hw drag enhancement.
D/WebViewDragEnhancement( 6838): dragReset.
D/WebViewDragEnhancement( 6838): dragReset cacheSize = 0
I/InputMethodManager( 6838): Starting input: reason=APP_CALLED_RESTART_INPUT_API
W/HwRemoteInputMethodManager( 6838): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager( 6838): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
I/InputMethodManager( 6838): showSoftInput, displayId=-1,callers=android.view.inputmethod.InputMethodManager.showSoftInput:1785 android.view.inputmethod.InputMethodManager.showSoftInput:1723 io.flutter.plugin.editing.TextInputPlugin.showTextInput:401 io.flutter.plugin.editing.TextInputPlugin$2.show:102 
D/InputMethodManager( 6838): showSoftInput() view=io.flutter.embedding.android.FlutterView{fcfca67 VFE...... .F...... 0,0-1080,2340 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:false, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
I/AssistStructure( 6838): Flattened final assist data: 480 bytes, containing 1 windows, 3 views
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
D/InsetsController( 6838): ViewUI_insets show(ime(), fromIme=true)
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:true, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10

Flutter Doctor output

Doctor output

[!] Flutter (Channel stable, 3.16.0, on macOS 13.5.1 22G90 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.16.0 on channel stable at /Users/Baibinbu/fvm/versions/3.16.0
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.1/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/Baibinbu/fvm/versions/3.16.0. Consider adding /Users/Baibinbu/fvm/versions/3.16.0/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (5 weeks ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/Baibinbu/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_HOME = /Users/Baibinbu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3

I also encountered the same problem and tried many methods but nothing worked. But you can try this. Although the effect is not very good, it works.

TextField(
        onTap: () {
          if (!widget.focusNode.hasFocus) {
           Future.delayed(150.milliseconds, () {
                widget.focusNode.requestFocus();
              });
          }
        },
        controller: widget.controller,
        focusNode: widget.focusNode,
        obscureText: true,
        decoration: const InputDecoration(
          border: InputBorder.none,
          contentPadding: EdgeInsets.zero,
        ),
      )

@laterdayi
Copy link

f549b09d0bd9e512fec403cba31028dc.mp4

@laterdayi
Copy link

laterdayi commented Apr 19, 2024

The same problem

18806dd31169639fdd7b82a387f10e29.mp4

@Colton127
Copy link

Also occurs on iPhone 11 running iOS 17.4.1

@hiFrankYoung
Copy link

Hey, trying this, 
1. Using Listener wrapper your TextField
2. Call unfocus() in onPointerDown 
3. Then the TextField still focus by default

Problem solved.

Listener(
          onPointerDown: (e) => {
            FocusScope.of(context).unfocus(),
          },
          child: TDInput(
            type: TDInputType.cardStyle,
            width: context.widthPx - 20,
            leftIcon: const Icon(TDIcons.mail),
            leftLabel: 'Email',
            backgroundColor: Colors.white,
            hintText: 'Please input email',
            onChanged: (email) {
              debug(email);
              controller.email.value = email;
            },
          ),
        )

@zqy789
Copy link

zqy789 commented May 20, 2024

我的vivo/iqoo手机也出现了相同问题,可能是因为在打开‘安全输入’功能之后,会在软键盘弹出的时候系统增加一层window,这个window会抢占焦点,这是防止录屏等功能的时候密码泄露所开发的,如果你使用Android Studio 的Start Mirroring 功能,你会发现当获取焦点之后屏幕是黑色的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices e: OS-version specific Affects only some versions of the relevant operating system f: material design flutter/packages/flutter/material repository. P3 Issues that are less important to the Flutter project platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

9 participants