-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when using setstate in onChanged #75
Comments
Move |
I have a similar issue and the MaskTextInputFormatter is already out of widget. In my case I`m using with a TextFormField and setting an initial value with a controller. Removing the mask from the field it works fine. Here is my code to reproduce the problem. import 'package:flutter/material.dart'; final phoneMaskFormatter = MaskTextInputFormatter(mask: '(###) ### ####'); class Test extends StatefulWidget { @OverRide class _TestState extends State { late TextEditingController _nameController; var myData = {'name': 'William', 'phone': '(305) 786 1234'}; @OverRide
} @OverRide @OverRide |
I'm having a similar problem too, aparentely on insert a value by controller, the formatEditUpdate is not triggered, and getUnmask Text() return the value before you set de text by controller. |
Having the same issue |
final _phoneInputFormatter = MaskTextInputFormatter(mask: '+998 (##) ### ## ##'); |
Please help me |
The formatter has internal state. Therefore, it is required that it be moved outside the build method. If the TextEditingController of TextField has an initial value, then that value must also be specified in the formatter constructor (or later using updateMask method) so that they are initially synchronized. |
Currently textfield clears after UI update (setState, for example). I use a timer in my app, which also updates the corresponding text widget that indicates remaining time, and UI updates every second, making input really frustrating, because every second textfield is being cleared, follow the example
The text was updated successfully, but these errors were encountered: