MaterialSwitchData constructor

const MaterialSwitchData({
  1. bool? value,
  2. ValueChanged<bool>? onChanged,
  3. Key? widgetKey,
  4. bool isEnabled = true,
  5. Color? activeThumbColor,
  6. Color? activeTrackColor,
  7. Color? inactiveThumbColor,
  8. Color? inactiveTrackColor,
  9. Color? focusColor,
  10. ImageProvider<Object>? activeThumbImage,
  11. ImageErrorListener? onActiveThumbImageError,
  12. ImageProvider<Object>? inactiveThumbImage,
  13. ImageErrorListener? onInactiveThumbImageError,
  14. WidgetStateProperty<Color?>? trackOutlineColor,
  15. WidgetStateProperty<double?>? trackOutlineWidth,
  16. WidgetStateProperty<Icon?>? thumbIcon,
  17. DragStartBehavior dragStartBehavior = kDefaultDragStartBehavior,
  18. WidgetStateProperty<MouseCursor>? mouseCursor,
  19. FocusNode? focusNode,
  20. ValueChanged<bool>? onFocusChange,
  21. bool autofocus = kDefaultAutofocus,
  22. WidgetStateProperty<Color?>? thumbColor,
  23. WidgetStateProperty<Color?>? trackColor,
  24. WidgetStateProperty<Color?>? overlayColor,
  25. MaterialTapTargetSize? materialTapTargetSize,
  26. Color? hoverColor,
  27. double? splashRadius,
  28. EdgeInsetsGeometry? padding,
})

isEnabled is a convenience property for setting onChanged == null automatically. mouseCursor is not proxied through a WidgetStateProperty for Switch. It is defined by matching the same template/behaviour.

Implementation

const MaterialSwitchData({
  super.value,
  super.onChanged,
  super.widgetKey,
  super.isEnabled,
  super.activeThumbColor,
  super.activeTrackColor,
  super.inactiveThumbColor,
  super.inactiveTrackColor,
  super.focusColor,
  super.activeThumbImage,
  super.onActiveThumbImageError,
  super.inactiveThumbImage,
  super.onInactiveThumbImageError,
  super.trackOutlineColor,
  super.trackOutlineWidth,
  super.thumbIcon,
  super.dragStartBehavior,
  super.mouseCursor,
  super.focusNode,
  super.onFocusChange,
  super.autofocus,
  this.thumbColor,
  this.trackColor,
  this.overlayColor,
  this.materialTapTargetSize,
  this.hoverColor,
  this.splashRadius,
  this.padding,
});