Field.currency constructor

Field.currency(
  1. String key, {
  2. String? label,
  3. required String currency,
  4. dynamic value,
  5. FormValidator? validate,
  6. bool autofocus = false,
  7. String? dummyData,
  8. Widget? header,
  9. Widget? footer,
  10. TextStyle? titleStyle,
  11. dynamic style,
  12. Map<String, NyTextField Function(NyTextField nyTextField)>? metaData = const {},
  13. bool? hidden = false,
  14. bool? readOnly,
})

Field.currency is a constructor that helps in managing currency fields

Implementation

Field.currency(
  this.key, {
  this.label,
  required String currency,
  this.value,
  this.validate,
  this.autofocus = false,
  this.dummyData,
  this.header,
  this.footer,
  this.titleStyle,
  this.style,
  this.metaData = const {},
  this.hidden = false,
  this.readOnly,
}) : cast = FormCast.currency(currency.toLowerCase()) {
  if (style == null) return;

  metaData = {};
  if (style is String) {
    style = style;
    return;
  }
  if (style is Map) {
    style as Map<String, dynamic>;
    metaData!["decoration_style"] =
        (style as Map<String, dynamic>).entries.first.value;
    style = (style as Map<String, dynamic>).entries.first.key;
  }
}