number_mask 1.0.4 copy "number_mask: ^1.0.4" to clipboard
number_mask: ^1.0.4 copied to clipboard

A Flutter package designed to allow developers to more easily mask numeric form fields.

number_mask #

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

Authors #

Usage #

The usage of NumberMask is very simple.

NumberMask(pattern: '###-###-####')

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. ###'),
    ],
),

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.

0
likes
130
pub points
17%
popularity

Publisher

verified publishervehm.dev

A Flutter package designed to allow developers to more easily mask numeric form fields.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on number_mask