WidgetSwitch2 constructor
WidgetSwitch2({
- Key? key,
- Color colorLeftBackground = Colors.red,
- double disableOpacity = 0.6,
- Color colorRightBackground = Colors.green,
- Color colorButton = const Color(0xffF0F0F0),
- double width = 100,
- Color backgroundCenter = const Color(0xFFF0F0F0),
- required ValueChanged onChange,
- int duration = 200,
- double buttonSize = 25,
- bool enable = true,
- String textLeft = "Off",
- String textRight = "On",
- List values = const [0, 2, 1],
- dynamic initValue = 2,
Implementation
WidgetSwitch2(
{this.key,
this.colorLeftBackground = Colors.red,
this.disableOpacity = 0.6,
this.colorRightBackground = Colors.green,
this.colorButton = const Color(0xffF0F0F0),
this.width = 100,
this.backgroundCenter = const Color(0xFFF0F0F0),
required this.onChange,
this.duration = 200,
this.buttonSize = 25,
this.enable = true,
this.textLeft = "Off",
this.textRight = "On",
this.values = const [0, 2, 1],
this.initValue = 2})
: assert((values.length >= 2 && values.length <= 3),
'You must provide a list with 2 or 3 values.'),
assert(width >= 60),
assert(disableOpacity >= 0 && disableOpacity <= 1),
assert(duration >= 200 && duration <= 2000),
super(key: key);