LiteSwitch constructor

LiteSwitch({
  1. Key? key,
  2. required String name,
  3. LiteSwitchPosition switchPosition = LiteSwitchPosition.left,
  4. LiteSwitchReactionArea reactionArea = LiteSwitchReactionArea.full,
  5. ValueChanged<bool>? onChanged,
  6. String? label,
  7. MarkdownTapLinkCallback? onTapLink,
  8. double paddingTop = 0.0,
  9. double paddingBottom = 0.0,
  10. double paddingLeft = 0.0,
  11. double paddingRight = 0.0,
  12. LiteFormValueSerializer serializer = nonConvertingValueConvertor,
  13. LiteFormValueSerializer? initialValueDeserializer,
  14. List<LiteValidator>? validators,
  15. Object? initialValue,
  16. AutovalidateMode? autovalidateMode,
  17. LiteSwitchType type = LiteSwitchType.adaptive,
  18. CustomLiteToggleBuilder? customLiteToggleBuilder,
  19. Color? activeColor,
  20. ImageProvider<Object>? activeThumbImage,
  21. Color? activeTrackColor,
  22. bool autofocus = false,
  23. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  24. Color? focusColor,
  25. FocusNode? focusNode,
  26. Color? hoverColor,
  27. Color? inactiveThumbColor,
  28. Color? inactiveTrackColor,
  29. MaterialTapTargetSize? materialTapTargetSize,
  30. MouseCursor? mouseCursor,
  31. ImageErrorListener? onActiveThumbImageError,
  32. ValueChanged<bool>? onFocusChange,
  33. MaterialStateProperty<Color?>? overlayColor,
  34. double? splashRadius,
  35. MaterialStateProperty<Color?>? thumbColor,
  36. MaterialStateProperty<Icon?>? thumbIcon,
  37. MaterialStateProperty<Color?>? trackColor,
  38. EdgeInsets childPadding = const EdgeInsets.symmetric(vertical: 8.0),
  39. Widget? child,
  40. String? text,
  41. bool useMarkdown = false,
  42. bool readOnly = false,
  43. bool useSmoothError = true,
  44. MarkdownStyleSheet? markdownStyleSheet,
  45. TextStyle? style,
  46. ImageErrorListener? onInactiveThumbImageError,
  47. EdgeInsets? smoothErrorPadding = const EdgeInsets.only(top: 8.0),
  48. TextStyle? errorStyle,
})

Implementation

LiteSwitch({
  Key? key,
  required this.name,
  this.switchPosition = LiteSwitchPosition.left,
  this.reactionArea = LiteSwitchReactionArea.full,
  this.onChanged,
  this.label,
  this.onTapLink,
  this.paddingTop = 0.0,
  this.paddingBottom = 0.0,
  this.paddingLeft = 0.0,
  this.paddingRight = 0.0,
  this.serializer = nonConvertingValueConvertor,
  this.initialValueDeserializer,
  this.validators,
  this.initialValue,
  this.autovalidateMode,
  this.type = LiteSwitchType.adaptive,
  this.customLiteToggleBuilder,
  this.activeColor,
  this.activeThumbImage,
  this.activeTrackColor,
  this.autofocus = false,
  this.dragStartBehavior = DragStartBehavior.start,
  this.focusColor,
  this.focusNode,
  this.hoverColor,
  this.inactiveThumbColor,
  this.inactiveTrackColor,
  this.materialTapTargetSize,
  this.mouseCursor,
  this.onActiveThumbImageError,
  this.onFocusChange,
  this.overlayColor,
  this.splashRadius,
  this.thumbColor,
  this.thumbIcon,
  this.trackColor,
  this.childPadding = const EdgeInsets.symmetric(
    vertical: 8.0,
  ),
  this.child,
  this.text,
  this.useMarkdown = false,
  this.readOnly = false,
  this.useSmoothError = true,
  this.markdownStyleSheet,
  this.style,
  this.onInactiveThumbImageError,
  this.smoothErrorPadding = const EdgeInsets.only(
    top: 8.0,
  ),
  this.errorStyle,
})  : assert(
        (child == null || text == null),
        'You cannot pass both `text` and `child` at the same time',
      ),
      super(key: key ?? Key(name));