Field.switchBox constructor
Field.switchBox(
- String key, {
- dynamic value,
- FormValidator? validate,
- bool autofocus = false,
- String? dummyData,
- Widget? header,
- TextStyle? titleStyle,
- dynamic style,
- Map<
String, NyTextField Function(NyTextField nyTextField)> ? metaData = const {}, - 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,
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;
}
}