WidgetSwitch1 constructor
WidgetSwitch1({
- Key? key,
- Color colorLeftIcon = Colors.red,
- Color colorLeftBackground = Colors.red,
- IconData? iconLeft = Icons.close,
- Color colorRightIcon = Colors.green,
- Color colorRightBackground = Colors.green,
- IconData? iconRight = Icons.check,
- Color colorButton = const Color(0xffF0F0F0),
- double width = 100,
- Color backgroundCenter = const Color(0xFFF0F0F0),
- required ValueChanged onChange,
- int duration = 200,
- bool enable = true,
- double disableOpacity = 0.6,
- double buttonSize = 20,
- List values = const [0, 2, 1],
- double? height,
- dynamic initValue = 2,
Implementation
WidgetSwitch1(
{this.key,
this.colorLeftIcon = Colors.red,
this.colorLeftBackground = Colors.red,
this.iconLeft = Icons.close,
this.colorRightIcon = Colors.green,
this.colorRightBackground = Colors.green,
this.iconRight = Icons.check,
this.colorButton = const Color(0xffF0F0F0),
this.width = 100,
this.backgroundCenter = const Color(0xFFF0F0F0),
required this.onChange,
this.duration = 200,
this.enable = true,
this.disableOpacity = 0.6,
this.buttonSize = 20,
this.values = const [0, 2, 1],
this.height,
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);