MorphSlider constructor
const
MorphSlider({
- Key? key,
- required bool stateValue,
- ThumbType thumbType = ThumbType.circle,
- bool isVertical = false,
- EdgeInsetsGeometry margin = EdgeInsets.zero,
- void onSwitch()?,
- void onSwipeLeft()?,
- void onSwipeRight()?,
- double offOpacity = 1.0,
- bool applyThumbRotationAnimation = true,
- double? height,
- double? width,
- IconData? offIcon,
- IconData? onIcon,
- Color offSliderColor = const Color(0xFF9E9E9E),
- Color onSliderColor = const Color(0xFF2196F3),
- Color offThumbColor = const Color(0xFF02383C),
- Color onThumbColor = const Color(0xFF02383C),
- Color sliderBorderColor = const Color(0x00000000),
- Color thumbBorderColor = const Color(0x00000000),
- double sliderBorderWidth = 0.0,
- double sliderRadius = 5.0,
- double sliderThikness = 10.0,
- double thumbBorderWidth = 0.0,
- double thumbRadius = 22.0,
- SwitcherSize size = SwitcherSize.medium,
- IconTransitionStyle iconTransitionStyle = IconTransitionStyle.scale,
- int durationInMs = 1000,
- TextDirection direction = TextDirection.ltr,
- bool disabled = false,
- Color? thumbIconColor,
- 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);