Skip to content
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

I find a bug when i using #53

Closed
mahanpyk opened this issue May 6, 2021 · 6 comments
Closed

I find a bug when i using #53

mahanpyk opened this issue May 6, 2021 · 6 comments

Comments

@mahanpyk
Copy link

mahanpyk commented May 6, 2021

I a musk for iban number and it works perfectly when entering values ​​but it does not work properly and does not clear when we use backspase
The pattern I used is this:
####-####-####-####-####-####

I test on flutter 2.2 and 2.0

I have tested both versions 1.2.1 and 2.0.0-nullsafety.2 and 2.2.0 and 2.2.1.

@marcglasberg
Copy link

It's really not working anymore. It used to work well, but does not anymore.

I have tested both versions 1.2.1 and 2.0.0-nullsafety.2.

It's possible a bug was introduced recently, but also the TextField widget itself may have changed something for Flutter 2 that's affecting this widget.

@subinsv
Copy link

subinsv commented May 26, 2021

We had a similar issue. Not sure this will help.

Converting the parent widget to stateful widget and declaring the MaskTextInputFormatter as an final variable seems to solve most of the issues related to backspace and random typing issues.

it would be great if somebody can confirm this.

I am on flutter 2.2

class _MyWidgetState extends State<MyWidget> {
final MaskTextInputFormatter mask = MaskTextInputFormatter(mask: '####-####-####-####-####-####');

build() {
//use the above created mask
}
}

@yisusparkr
Copy link

yisusparkr commented May 31, 2021

I faced the same issue.

If you want to format an input of numbers you can fix this bug adding the keyboardType property to the TextFormField or TextField.

final maskFormatter = new MaskTextInputFormatter(mask: '+## (###) ### ####', filter: { "#": RegExp(r'[0-9]') },);
TextFormField(
    keyboardType: TextInputType.phone,
    inputFormatters: [maskFormatter],
),

I tried too formating an input of text but in that case the bug persist. I'm using Flutter 2.2.1

@mahanpyk
Copy link
Author

mahanpyk commented Jun 1, 2021

I used a custom keyboard and did so by calling its converter method. At first I thought it might be because of the custom field text, and then I used the library on another project as recommended, but it was still the same problem.

@bsbilal
Copy link

bsbilal commented Mar 3, 2022

that error cause could be it 'setstate' calls in 'onChanged(s)' method. check that

@mahanpyk
Copy link
Author

mahanpyk commented Mar 3, 2022

that error cause could be it 'setstate' calls in 'onChanged(s)' method. check that

it's true
But I use state management Getx and don't use setState. I debugged this and the callback is wrong

@siqwin siqwin closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants