MorphSlider constructor

const MorphSlider({
  1. Key? key,
  2. required bool stateValue,
  3. ThumbType thumbType = ThumbType.circle,
  4. bool isVertical = false,
  5. EdgeInsetsGeometry margin = EdgeInsets.zero,
  6. void onSwitch(
    1. bool
    )?,
  7. void onSwipeLeft(
    1. bool
    )?,
  8. void onSwipeRight(
    1. bool
    )?,
  9. double offOpacity = 1.0,
  10. bool applyThumbRotationAnimation = true,
  11. double? height,
  12. double? width,
  13. IconData? offIcon,
  14. IconData? onIcon,
  15. Color offSliderColor = const Color(0xFF9E9E9E),
  16. Color onSliderColor = const Color(0xFF2196F3),
  17. Color offThumbColor = const Color(0xFF02383C),
  18. Color onThumbColor = const Color(0xFF02383C),
  19. Color sliderBorderColor = const Color(0x00000000),
  20. Color thumbBorderColor = const Color(0x00000000),
  21. double sliderBorderWidth = 0.0,
  22. double sliderRadius = 5.0,
  23. double sliderThikness = 10.0,
  24. double thumbBorderWidth = 0.0,
  25. double thumbRadius = 22.0,
  26. SwitcherSize size = SwitcherSize.medium,
  27. IconTransitionStyle iconTransitionStyle = IconTransitionStyle.scale,
  28. int durationInMs = 1000,
  29. TextDirection direction = TextDirection.ltr,
  30. bool disabled = false,
  31. Color? thumbIconColor,
  32. Curve switchCurve = Curves.bounceOut,
})

Implementation

const MorphSlider({
  super.key,
  required this.stateValue,
  this.thumbType = ThumbType.circle,
  this.isVertical = false,
  this.margin = EdgeInsets.zero,
  this.onSwitch,
  this.onSwipeLeft,
  this.onSwipeRight,
  this.offOpacity = 1.0,
  this.applyThumbRotationAnimation = true,
  this.height,
  this.width,
  this.offIcon,
  this.onIcon,
  this.offSliderColor = const Color(0xFF9E9E9E),
  this.onSliderColor = const Color(0xFF2196F3),
  this.offThumbColor = const Color(0xFF02383C),
  this.onThumbColor = const Color(0xFF02383C),
  this.sliderBorderColor = const Color(0x00000000),
  this.thumbBorderColor = const Color(0x00000000),
  this.sliderBorderWidth = 0.0,
  this.sliderRadius = 5.0,
  this.sliderThikness = 10.0,
  this.thumbBorderWidth = 0.0,
  this.thumbRadius = 22.0,
  this.size = SwitcherSize.medium,
  this.iconTransitionStyle = IconTransitionStyle.scale,
  this.durationInMs = 1000,
  this.direction = TextDirection.ltr,
  this.disabled = false,
  this.thumbIconColor,
  this.switchCurve = Curves.bounceOut,
})  : assert(
        height != null && width != null || height == null && width == null,
        DIMENSIONS_ERROR,
      ),
      assert(durationInMs > 0),
      assert(sliderThikness > 0.0),
      assert(thumbRadius > 0.0, THUMB_RADIUS),
      assert(offOpacity >= 0.0 || offOpacity <= 1.0);