Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TextField with inputFormatters & keyboardType onChange causes infinite loop #79844

Closed
Assignees
LongCatIsLooong
Labels
P1High-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds
@lyf571321556

Description

@lyf571321556

Steps to Reproduce

code sample
import'package:flutter/material.dart';import'package:flutter/cupertino.dart';import'package:flutter/services.dart';finalColor darkBlue=Color.fromARGB(255,18,32,47);voidmain() {runApp(MyApp());}classMyAppextendsStatelessWidget {@overrideWidgetbuild(BuildContext context) {returnMaterialApp(      theme:ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),      debugShowCheckedModeBanner:false,      home:Scaffold(        body:Center(          child:MyWidget(),        ),      ),    );  }}classMyWidgetextendsStatelessWidget {@overrideWidgetbuild(BuildContext context) {returnTextField(      autocorrect:false,      enableSuggestions:false,      keyboardType:TextInputType.emailAddress,      inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"""[a-zA-Z0-9\_\.\,\-\(\)\/\=\+\?\>\<\!\*\'\"\;\&\@\#\:\%\[\]\‘\\\$\{\}\^\|\~\`]+""")),      ],    );  }}

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 - developfor 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 - developfor iOS and macOS    • Xcode at /Applications/Xcode.app/Contents/Developer    • Xcode 12.4, Build version 12D4e    • CocoaPods version 1.10.1[✓] Chrome - developfor 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-setupfor 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 isset    • 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 issuesin 1 category.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp