Field.mask constructor

Field.mask(
  1. String key, {
  2. dynamic value,
  3. FormValidator? validate,
  4. bool autofocus = false,
  5. String? dummyData,
  6. Widget? header,
  7. Widget? footer,
  8. TextStyle? titleStyle,
  9. dynamic style,
  10. Map<String, NyTextField Function(NyTextField nyTextField)>? metaData = const {},
  11. bool? hidden = false,
  12. Widget? prefixIcon,
  13. bool clearable = false,
  14. Widget? clearIcon,
  15. required String? mask,
  16. String? match = r'[\w\d]',
  17. bool? maskReturnValue = false,
})

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

Implementation

Field.mask(
  this.key, {
  this.value,
  this.validate,
  this.autofocus = false,
  this.dummyData,
  this.header,
  this.footer,
  this.titleStyle,
  this.style,
  this.metaData = const {},
  this.hidden = false,
  Widget? prefixIcon,
  bool clearable = false,
  Widget? clearIcon,
  required String? mask,
  String? match = r'[\w\d]',
  bool? maskReturnValue = false,
}) : cast = FormCast.mask(
        prefixIcon: prefixIcon,
        clearable: clearable,
        clearIcon: clearIcon,
        mask: mask,
      ) {
  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;
  }
}