CustomSwitch constructor

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

Switch 开关组件

Implementation

const CustomSwitch({
  required this.value,
  required this.onChanged,
  super.key,
  this.activeColor,
  this.activeTrackColor,
  this.inactiveThumbColor,
  this.inactiveTrackColor,
  this.activeThumbImage,
  this.onActiveThumbImageError,
  this.inactiveThumbImage,
  this.onInactiveThumbImageError,
  this.thumbColor,
  this.trackColor,
  this.trackOutlineColor,
  this.trackOutlineWidth,
  this.thumbIcon,
  this.materialTapTargetSize,
  this.mouseCursor,
  this.focusColor,
  this.hoverColor,
  this.overlayColor,
  this.splashRadius,
  this.focusNode,
  this.onFocusChange,
  this.autofocus = false,
  this.dragStartBehavior = DragStartBehavior.start,
  this.applyCupertinoTheme,
});