Home > database >  How can I change the text when its length 14 characters with TextInputFormat?
How can I change the text when its length 14 characters with TextInputFormat?

Time:08-02

well, I have a textFormField. This TextFormField will use to take user phone number. What I wanna thing is when the phone number length is 14 characters, all texts which on seems on the TextFormField would "xxx xxx".

How can I doing this?

CodePudding user response:

You can use mask_text_input_formatter

TextFormField(
inputFormatters: [
 ExampleMask(
      formatter: MaskTextInputFormatter(mask: " # (###) ###-##-##"),
      textInputType: TextInputType.phone
    ),
],
  • Related