Skip to content

Setting text through TextEditingController.text doesn't apply the TextInputFormatters #106821

@jordan-lumley

Description

@jordan-lumley

Steps to Reproduce

  1. Build a basic flutter app with a single textfield/textformfield and a TextEditingController
  2. Add an inputFormatter
  3. Have a button to trigger setting the TextEditingController '.text' property and the input formatters are not triggered/applied.

Expected results: The inputFormatters get applied instead of just ignoring them entirely. My specific use case is building an onscreen keyboard and inputting keystrokes manually to a TextEditingController.

Actual results: The value is set no matter what the inputFormatters are.

I am not sure why but there was another issue(#30369) posted for this exact same reason and it was closed due to operating "as designed"? Not sure how that's supposed to be the designed way but would love more of an explanation.

Flutter version:
Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c860cba (3 months ago) • 2022-03-25 00:23:12 -0500
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2

Metadata

Metadata

Labels

a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions