Closed MrErkinjon closed 9 months ago
after entering the phone number through the code, all the numbers are deleted when editing.
after entering the phone number through the code, all the numbers are deleted when editing.
Same situation with me.
TextFormField( keyboardType: TextInputType.number, inputFormatters: [ MaskTextInputFormatter( mask: '#####-###', filter: {"#": RegExp(r'[0-9]')} ) ], )
Flutter does not format the value on attach controller to text field, so this must be done manually, something like that:
@override
void initState() {
super.initState();
textEditingController.value = maskTextInputFormatter.formatEditUpdate(TextEditingValue.empty, const TextEditingValue(text: "Some initial value"));
}
https://github.com/siqwin/mask_text_input_formatter/assets/97740214/56230359-b1e8-4b8b-a55a-92e1b7a45d47