getNumericFormatters static method
List<TextInputFormatter>
getNumericFormatters({
- bool allowDecimal = true,
- int? maxDecimals,
- int? maxLength,
- bool useNumericFormatter = false,
- ValueChanged? onValueChanged,
Creates formatters for numeric input with decimal and negative number support
Implementation
static List<TextInputFormatter> getNumericFormatters({
bool allowDecimal = true,
int? maxDecimals,
int? maxLength,
bool useNumericFormatter = false,
ValueChanged<dynamic>? onValueChanged,
}) => <TextInputFormatter>[
if (maxLength != null) _getMaxLengthFormatter(maxLength),
FilteringTextInputFormatter.digitsOnly,
if (useNumericFormatter)
_createNumberFormatFormatter(
allowDecimal: allowDecimal,
maxDecimals: maxDecimals,
onValueChanged: onValueChanged,
)
else
_createNumericValidator(
allowDecimal: allowDecimal,
maxDecimals: maxDecimals,
onValueChanged: onValueChanged,
),
];