Field.switchBox constructor

Field.switchBox(
  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. MouseCursor? mouseCursor,
  13. Color? activeColor,
  14. Color? fillColor,
  15. Color? checkColor,
  16. Color? hoverColor,
  17. Color? overlayColor,
  18. double? splashRadius,
  19. MaterialTapTargetSize? materialTapTargetSize,
  20. VisualDensity? visualDensity,
  21. FocusNode? focusNode,
  22. ShapeBorder? shape,
  23. BorderSide? side,
  24. bool isError = false,
  25. bool? enabled,
  26. Color? tileColor,
  27. Widget? title,
  28. Widget? subtitle,
  29. bool isThreeLine = false,
  30. bool? dense,
  31. Widget? secondary,
  32. bool selected = false,
  33. ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  34. EdgeInsetsGeometry? contentPadding,
  35. bool tristate = false,
  36. ShapeBorder? checkboxShape,
  37. Color? selectedTileColor,
  38. ValueChanged<bool?>? onFocusChange,
  39. bool? enableFeedback,
  40. String? checkboxSemanticLabel,
})

Field.switchBox is a constructor that helps in managing switch fields

Implementation

Field.switchBox(
  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,
  MouseCursor? mouseCursor,
  Color? activeColor,
  Color? fillColor,
  Color? checkColor,
  Color? hoverColor,
  Color? overlayColor,
  double? splashRadius,
  MaterialTapTargetSize? materialTapTargetSize,
  VisualDensity? visualDensity,
  FocusNode? focusNode,
  ShapeBorder? shape,
  BorderSide? side,
  bool isError = false,
  bool? enabled,
  Color? tileColor,
  Widget? title,
  Widget? subtitle,
  bool isThreeLine = false,
  bool? dense,
  Widget? secondary,
  bool selected = false,
  ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  EdgeInsetsGeometry? contentPadding,
  bool tristate = false,
  ShapeBorder? checkboxShape,
  Color? selectedTileColor,
  ValueChanged<bool?>? onFocusChange,
  bool? enableFeedback,
  String? checkboxSemanticLabel,
}) : cast = FormCast.switchBox(
          mouseCursor: mouseCursor,
          activeColor: activeColor,
          fillColor: fillColor,
          checkColor: checkColor,
          hoverColor: hoverColor,
          overlayColor: overlayColor,
          splashRadius: splashRadius,
          materialTapTargetSize: materialTapTargetSize,
          visualDensity: visualDensity,
          focusNode: focusNode,
          autofocus: autofocus,
          shape: shape,
          side: side,
          isError: isError,
          enabled: enabled,
          tileColor: tileColor,
          title: title,
          subtitle: subtitle,
          isThreeLine: isThreeLine,
          dense: dense,
          secondary: secondary,
          selected: selected,
          controlAffinity: controlAffinity,
          contentPadding: contentPadding,
          tristate: tristate,
          checkboxShape: checkboxShape,
          selectedTileColor: selectedTileColor,
          onFocusChange: onFocusChange,
          enableFeedback: enableFeedback,
          checkboxSemanticLabel: checkboxSemanticLabel) {
  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;
  }
}