Field.currency constructor

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

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

Implementation

Field.currency(
  this.key, {
  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,
}) : 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;
  }
}