NumbersTextInputFormatter class
NumbersTextInputFormatter is a TextInputFormatter that allows only numbers to be typed, with four options:
-
NumbersTextInputFormatter.integer: Only digits (0 to 9) can be typed.
-
NumbersTextInputFormatter.decimal: Only digits (0 to 9), plus dot or comma can be typed. Whichever the user types is converted to the current locale's decimal separator.
-
NumbersTextInputFormatter.decimalWithDot: Only digits (0 to 9), plus dot or comma can be typed, but commas are always converted to dots.
-
NumbersTextInputFormatter.decimalWithComma: Only digits (0 to 9), plus dot or comma can be typed, but dots are always converted to commas.
- Inheritance
-
- Object
- TextInputFormatter
- NumbersTextInputFormatter
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Called when text is being typed or cut/copy/pasted in the EditableText.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- decimal → NumbersTextInputFormatter
-
Allows only typing numbers 0-9, plus dot or comma,
but if the user types a dot or a comma it will always be converted
to the current decimal separator (depending on the locale).
final
- decimalWithComma → NumbersTextInputFormatter
-
Allows only typing numbers 0-9, plus dot or comma,
but if the user types a dot it will always appear as a comma.
final
- decimalWithDot → NumbersTextInputFormatter
-
Allows only typing numbers 0-9, plus dot or comma,
but if the user types a comma it will always appear as a dot.
final
- integer → NumbersTextInputFormatter
-
Allows only typing numbers 0-9.
final
Static Methods
-
localeDecimalSeparator(
) → String - Returns the default decimal separator for the current platform locale.