-
Notifications
You must be signed in to change notification settings - Fork 30.4k
TextField with inputFormatters & keyboardType onChange causes infinite loop #79844
Copy link
Copy link
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 2.0Found to occur in 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 2.0Found to occur in 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Steps to Reproduce
code sample
TextField with inputFormatters (for example, WhitelistingTextInputFormatter.digitsOnly) and some of keyboardTypes (phone, datetime, visiblePassword and number) work not as it expected. If i type not a digit (remember, we are using WhitelistingTextInputFormatter.digitsOnly inputFormatters), onChange fires twice and the last one will be with forbidden symbol in onChange text. With another keyboardType onChange fires only once and without "forbidden" symbol in the text (not sure if it even should fire).
Expected results: Forbidden symbols shouldn't be in the onChange text.
Actual results: onChange fires twice with forbidden symbol in the last change.
flutter doctor -v
╰ flutter doctor -v [✓] Flutter (Channel beta, 2.1.0-12.2.pre, on Mac OS X 10.15.5 19F101 darwin-x64, locale zh-Hans-CN) • Flutter version 2.1.0-12.2.pre at /Users/liuyanfeng/Library/flutter • Framework revision 5bedb7b1d5 (3 weeks ago), 2021-03-17 17:06:30 -0700 • Engine revision 711ab3fda0 • Dart version 2.13.0 (build 2.13.0-116.0.dev) • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/liuyanfeng/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • ANDROID_HOME = /Users/liuyanfeng/Library/Android/sdk • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java • Java version Java(TM) SE Runtime Environment (build 1.8.0_191-b12) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). [✓] IntelliJ IDEA Ultimate Edition (version 2019.2.3) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin version 43.0.2 • Dart plugin version 192.8052 [✓] Proxy Configuration • HTTP_PROXY is set • NO_PROXY is localhost,127.0.0.1 • NO_PROXY contains 127.0.0.1 • NO_PROXY contains localhost [✓] Connected device (4 available) • JKM AL00a (mobile) • HYJNW18A15002346 • android-arm64 • Android 9 (API 28) • Ha0 (mobile) • 60748a91d3d416ed437eb16315e99de062468d7a • ios • iOS 14.2 • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.5 19F101 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114 ! Doctor found issues in 1 category.