Number Text Input Formatter for Flutter.
# Add into pubspec.yaml
dependencies:
number_text_input_formatter: ^lastVersion
For number
TextField(
inputFormatters: [
NumberTextInputFormatter(
integerDigits: 10,
decimalDigits: 2,
maxValue: '1000000000.00',
decimalSeparator: '.',
groupDigits: 3,
groupSeparator: ','
allowNegative: false,
overrideDecimalPoint: true,
insertDecimalPoint: false,
insertDecimalDigits: true,
),
],
keyboardType: TextInputType.number,
),
For currency
TextField(
inputFormatters: [CurrencyTextInputFormatter()],
keyboardType: TextInputType.number,
),
For percentage
TextField(
inputFormatters: [PercentageTextInputFormatter()],
keyboardType: TextInputType.number,
),