flutter-masked-text
flutter-masked-text copied to clipboard
optional character translator
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]*)'),
});