Field.radio constructor

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

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

Implementation

Field.radio(
  this.key, {
  this.label,
  this.value,
  this.validate,
  this.autofocus = false,
  this.dummyData,
  this.header,
  this.footer,
  this.style,
  this.metaData = const {},
  this.hidden = false,
  this.readOnly,
  required List<String> options,
  NyRadioTileStyle? nyRadioTileStyle,
}) : cast = FormCast.radio(
          options: options, nyRadioTileStyle: nyRadioTileStyle) {
  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;
  }
}