Switcher constructor
Switcher({
- bool value = false,
- SwitcherSize size = SwitcherSize.small,
- Color switcherButtonColor = Colors.white,
- double switcherRadius = 50,
- double switcherButtonRadius = 50,
- double switcherButtonAngleTransform = 0,
- bool enabledSwitcherButtonRotate = true,
- BoxShape switcherButtonBoxShape = BoxShape.circle,
- Color colorOn = Colors.blue,
- Color colorOff = Colors.black,
- IconData iconOff = Icons.circle,
- IconData iconOn = Icons.check,
- Duration animationDuration = const Duration(milliseconds: 500),
- Curve curveType = Curves.easeInOut,
- Function? onTap,
- Function? onDoubleTap,
- Function? onSwipe,
- required dynamic onChanged(),
Implementation
Switcher(
{this.value = false,
this.size = SwitcherSize.small,
this.switcherButtonColor = Colors.white,
this.switcherRadius = 50,
this.switcherButtonRadius = 50,
this.switcherButtonAngleTransform = 0,
this.enabledSwitcherButtonRotate = true,
this.switcherButtonBoxShape = BoxShape.circle,
this.colorOn = Colors.blue,
this.colorOff = Colors.black,
this.iconOff = Icons.circle,
this.iconOn = Icons.check,
this.animationDuration = const Duration(milliseconds: 500),
this.curveType = Curves.easeInOut,
this.onTap,
this.onDoubleTap,
this.onSwipe,
required this.onChanged})
: _width = size == SwitcherSize.small
? 55
: size == SwitcherSize.medium
? 80
: 105,
_height = size == SwitcherSize.small
? 20
: size == SwitcherSize.medium
? 30
: 40,
_switcherButtonOffset = size == SwitcherSize.small
? switcherButtonBoxShape == BoxShape.rectangle
? Offset(36, 0.5)
: switcherButtonRadius < 4
? Offset(35, 0.3)
: Offset(34, 0.2)
: size == SwitcherSize.medium
? switcherButtonBoxShape == BoxShape.rectangle
? Offset(51, 0)
: switcherButtonRadius < 4
? Offset(51, 0.5)
: Offset(50, 0.3)
: switcherButtonBoxShape == BoxShape.rectangle
? Offset(67, 1)
: switcherButtonRadius < 4
? Offset(67, 0.5)
: Offset(65, 0.5),
_switcherButtonSize = size == SwitcherSize.small
? switcherButtonBoxShape == BoxShape.rectangle
? 12
: switcherButtonRadius < 4
? 10
: 15
: size == SwitcherSize.medium
? switcherButtonBoxShape == BoxShape.rectangle
? 22
: switcherButtonRadius < 4
? 17
: 25
: size == SwitcherSize.large
? switcherButtonBoxShape == BoxShape.rectangle
? 28
: switcherButtonRadius < 4
? 22
: 33
: 33,
_switcherButtonIconSize = size == SwitcherSize.small
? switcherButtonBoxShape == BoxShape.rectangle
? 11
: switcherButtonRadius < 4
? 10
: 15
: size == SwitcherSize.medium
? switcherButtonBoxShape == BoxShape.rectangle
? 18
: switcherButtonRadius < 4
? 15
: 21
: size == SwitcherSize.large
? switcherButtonBoxShape == BoxShape.rectangle
? 24
: switcherButtonRadius < 4
? 21
: 27
: 27,
_switcherButtonPadding = size == SwitcherSize.small
? switcherButtonBoxShape == BoxShape.rectangle
? 4
: switcherButtonRadius < 4
? 5
: 2.5
: size == SwitcherSize.medium
? switcherButtonBoxShape == BoxShape.rectangle
? 4
: switcherButtonRadius < 4
? 7
: 3
: switcherButtonBoxShape == BoxShape.rectangle
? 5
: switcherButtonRadius < 4
? 9
: 4;