GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing api.flutter.dev — TextEditingController class - widgets library - Dart API TextEditingController classA controller for an editable text field. Whenever the user modifies a text field with an associated TextEditingController, the text field updates value and the controller notifies its listeners. Listeners can then read the text and selection properties to learn what the user has typed or how the selection has been updated. Similarly, if you modify the text or selection properties, the text field will be notified and will update itself appropriately. A TextEditingController can also be used to provide an initial value for a text field. If you build a text field with a controller that already has text, the text field will use that text as its initial value. The value (as well as text and selection) of this controller can be updated from within a listener added to this controller. Be aware of infinite loops since the listener will also be notified of the changes made from within itself. Modifying the composing region from within a listener can also have a bad interaction with some input methods. Gboard, for example, will try to restore the composing region of the text if it was modified programmatically, creating an infinite loop of communications between the framework and the input method. Consider using TextInputFormatters instead for as-you-type text modification. TextInputFormatters, such as those supplied to EditableText.inputFormatters, only run when the user changes the text in the text field, for example using the keyboard or the text selection menu. They don't run when the text is changed programmatically through this controller, such as by setting value or text, or by calling clear. If a programmatically set value needs to be formatted, apply the formatting manually before updating the controller. If both the text and selection properties need to be changed, set the controller's value instead. Setting text will clear the selection and composing range. Remember to dispose of the TextEditingController when it is no longer needed. This will ensure we discard any resources used by the object.
This example creates a TextField with a TextEditingController whose
change listener forces the entered text to be lower case and keeps the
cursor at the end of the input.
link
To create a local project with this code sample, run: See also:
Constructors
Properties
Methods
Operators
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |