CurrencyTextInputFormatter class
Flutter plugin for currency text input formatter.
See the official documentation for more information on how to use TextInputFormatter.
- Inheritance
-
- Object
- TextInputFormatter
- CurrencyTextInputFormatter
Constructors
- CurrencyTextInputFormatter(NumberFormat format, {bool enableNegative = true, InputDirection inputDirection = InputDirection.right, num? minValue, num? maxValue, dynamic onChange(String)?})
-
Builds an CurrencyTextInputFormatter with the following parameters.
factory
- CurrencyTextInputFormatter.currency({String? locale, String? name, String? symbol, int? decimalDigits, String? customPattern, bool turnOffGrouping = false, bool enableNegative = true, InputDirection inputDirection = InputDirection.right, num? minValue, num? maxValue, dynamic onChange(String)?})
-
Builds an CurrencyTextInputFormatter with the following parameters.
factory
- CurrencyTextInputFormatter.simpleCurrency({String? locale, String? name, int? decimalDigits, bool turnOffGrouping = false, bool enableNegative = true, InputDirection inputDirection = InputDirection.right, num? minValue, num? maxValue, dynamic onChange(String)?})
-
Builds an CurrencyTextInputFormatter with simpleCurrency the following parameters.
factory
Properties
- enableNegative → bool
-
Defaults
enableNegative
is true.final - format → NumberFormat
-
NumberFormat
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputDirection → InputDirection
-
Defaults
inputDirection
is InputDirection.right.final - maxValue → num?
-
Defaults
maxValue
is null.final - minValue → num?
-
Defaults
minValue
is null.final - numberFormat → NumberFormat
-
Returns the NumberFormat created on currency and simpleCurrency constructors
no setter
- onChange → (dynamic Function(String)?)
-
Callback when value is changed.
You can use this to listen to value changes.
e.g. onChange: (value) => print(value);
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
formatDouble(
double value) → String - Method for formatting value. You can use initialValue(double) with this method.
-
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Called when text is being typed or cut/copy/pasted in the EditableText.
override
-
formatString(
String value) → String - Method for formatting value. You can use initialValue with this method.
-
getDouble(
) → double - get double value
-
getFormattedValue(
) → String -
Get String type value with format such as
$ 2,000.00
-
getUnformattedValue(
) → num -
Get num type value without format such as
2000.00
-
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