number_mask

Last updated:

0 purchases

number_mask Image
number_mask Images
Add to Cart

Description:

number mask

number_mask #
A minimalistic approach to helping developers more easily mask/format numeric fields without requiring new field widgets.
Authors #

@vehm

Usage #
The usage of NumberMask is very simple.
NumberMask(pattern: '###-###-####')
copied to clipboard
Simply put #'s in every position you want a number to go. The pattern can be anything you want, including letters and symbols - anything that can normally be input into a TextField or TextFormField. Input will automatically be masked to the pattern you have defined.

For Example:
import 'package:number_mask/number_mask.dart';

...

TextFormField(
controller: _phoneController,
decoration: const InputDecoration(
labelText: 'Phone Number*',
),
keyboardType: TextInputType.phone,
inputFormatters: [
NumberMask(pattern: '###-###-#### Ext. ###'),
],
),
copied to clipboard
The above example will automatically mask user input to the pattern we have defined: i.e. 555-555-5555 Ext. 555.

If the pattern is not defined, it will default to a free-form (read: empty) pattern. This will allow only numeric input without a defined length.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.