A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns
import 'package:pattern_formatter/pattern_formatter.dart';
- Integer number:
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
ThousandsFormatter()
],
)
- Decimal number:
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
ThousandsFormatter(allowFraction: true)
],
)
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
CreditCardFormatter(),
],
)
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
DateInputFormatter(),
],
)