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

optional character translator #63

Open
deepak786 opened this issue Jan 26, 2021 · 0 comments
Open

optional character translator #63

deepak786 opened this issue Jan 26, 2021 · 0 comments

Comments

@deepak786
Copy link

Currently, the library has the following translators.

return {
      'A': new RegExp(r'[A-Za-z]'),
      '0': new RegExp(r'[0-9]'),
      '@': new RegExp(r'[A-Za-z0-9]'),
      '*': new RegExp(r'.*')
};

It would be great to have a translator for optional things. like:

'a' = similar to 'A' but will be optional.
'1' = similar to '0' but will be optional.
'<' = similar to '@' but will be optional.
'>' = simlilar to '*' but will be optional.

For e.g:

if the mask is '11-1' then it can accept the following inputs:

9
9-9
99
99-9

I already tried to use the translator but it is not working:

_accountCtrl =
        MaskedTextController(mask: '**-*', translator: {
      '*': RegExp(r'([0-9]*)'),
    });
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

1 participant