Skip to content

TextField ignores user input, and cursor is rendered wrong in the middle of the text #120631

@ebadta81

Description

@ebadta81

Steps to Reproduce

Hello, there is an input problem with TextField or TextFromField on my Redmi 6.
When my page rendered, and I click first time on a TextField, it gets focus, and the keyboard coming up, and i type some numbers, but nothing appears in the TextField.

I figured out, it causes the keyboardType: TextInputType.number, settings, and i noticed visually, that the cursor is blinking first in the right place, but after the xiaomi keyboard coming up, the cursor is moving to the center of the TextField, and in this state, i cannot type anything.

I'm sure the error is caused by the xiaomi numeric keypad. If I configure with normal keyboard, everything is fine.

This wrong state happening only for the first click on the Textfield. If I click after to another, it is ok, and I click again to the first one is also ok.

If I have only one TextField, i can only get out of this wrong state, if i click on the right side of the TextField. It is not easy to find where it get's the good focus (cursor).

There are no error messages even with verbose mode.

Code sample
  @override
  Widget build(BuildContext context) {
    return Row(children: [
      SizedBox(
          width: 60,
          child: TextField(
            controller: textController,
            expands: false,
            textAlign: TextAlign.center,
            keyboardType: TextInputType.number,
            inputFormatters: <TextInputFormatter>[
              FilteringTextInputFormatter.digitsOnly
            ],
            decoration: const InputDecoration(
              contentPadding: EdgeInsets.all(4),
              isDense: true,
              fillColor: Color(0xff202020),
              border: UnderlineInputBorder(),
            ),
          )),
      Padding(
        padding: const EdgeInsets.only(left: 7.5, right: 7.5),
        child: Text(cikk.me),
      ),
      Container(
        color: blue,
        child: SizedBox(
          width: 80,
          height: 32,
          child: Stack(
              alignment: Alignment.center,
              clipBehavior: Clip.none,
              children: createIcon(cikk)),
        ),
      ),
    ]);
  }
Logs

$ flutter doctor -v
[!] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale en-HU)
    • Flutter version 3.7.3 on channel stable at /Users/myuser/Documents/Programming/install/flutter
    ! The flutter binary is not on your path. Consider adding /Users/myuser/Documents/Programming/install/flutter/bin to your path.
    ! The dart binary is not on your path. Consider adding /Users/myuser/Documents/Programming/install/flutter/bin to your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9944297138 (5 days ago), 2023-02-08 15:46:04 -0800
    • Engine revision 248290d6d5
    • Dart version 2.19.2
    • DevTools version 2.20.1
    • 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 31.0.0)
    • Android SDK at /Users/myuser/Library/Android/sdk/
    • Platform android-33, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.1)
    • 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 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (3 available)
    • Redmi 6 (mobile) • d5b3a88b7d29 • android-arm    • Android 9 (API 28)
    • macOS (desktop)  • macos        • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)     • chrome       • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

When the cursor is in a wrong state:

IMG_E1602

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions