Field.currency constructor
Field.currency(})
Field.currency is a constructor that helps in managing currency fields
Implementation
Field.currency(
this.key, {
this.label,
required String currency,
String? value,
this.validator,
this.autofocus = false,
this.dummyData,
this.header,
this.footer,
this.titleStyle,
this.hidden = false,
this.readOnly,
Function(dynamic value)? onChanged,
FieldStyleTextField? style,
}) : _value = value,
this.style = style ?? FieldStyleTextField() {
CurrencyMeta currencyMeta = CurrencyInputMatcher.getCurrencyMeta(
"currency:" + currency,
value: value ?? "0",
onChanged: onChanged,
);
this.style = (this.style as FieldStyleTextField).copyWith(
type: "currency",
keyboardType: const TextInputType.numberWithOptions(decimal: true),
inputFormatters: [currencyMeta.formatter],
);
_value = currencyMeta.initialValue;
setOnChanged(onChanged);
widget = NyFormTextField.fromField(this);
}