Last updated:
0 purchases
mask input formatter
mask_input_formatter #
The package provides TextInputFormatter for TextField and TextFormField which format the input by a given mask.
Example #
Check 'example' folder for code sample
Usage #
Follow the install guide
Importing the library:
import 'package:mask_input_formatter/mask_input_formatter.dart';
copied to clipboard
Create a mask formatter:
MaskInputFormatter myFormatter = MaskInputFormatter(mask: '(AA) #####');
copied to clipboard
Set with TextField/TextFormField:
TextFormField(
inputFormatters: [myFormatter],
decoration: InputDecoration(
hintText: "(AB) 12345",
)
) // TextFormField
copied to clipboard
Result #
// Input --> JK75757
// Output --> (JK) 75757 set formatted text on TextField
copied to clipboard
Other Mask #
You can use the mask whatever you defined in formatter:
MaskInputFormatter dateFormatter = MaskInputFormatter(mask: '##/##/####');
// --> 26/05/2021
MaskInputFormatter phoneFormatter = MaskInputFormatter(mask: '+# (###) ###-####');
// --> +1 (234) 567-8901
MaskInputFormatter numberFormatter = MaskInputFormatter(mask: 'AAA-###', textAllCaps: true);
// --> XYZ-789
copied to clipboard
Note #
In last example. --> (AAA-###)
'A' character will allow only letters from A-Z.
'#' character will allow only numbers.
And other characters and symbols will be added as mask.
Contributing #
Suggestions and Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Developer Team: #
Amjad Jamali & his team members (Kamran Khan, Hina Hussain, Faiza Farooqui) 🎉
License #
MIT
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.