WidgetSwitch1 constructor

WidgetSwitch1({
  1. Key? key,
  2. Color colorLeftIcon = Colors.red,
  3. Color colorLeftBackground = Colors.red,
  4. IconData? iconLeft = Icons.close,
  5. Color colorRightIcon = Colors.green,
  6. Color colorRightBackground = Colors.green,
  7. IconData? iconRight = Icons.check,
  8. Color colorButton = const Color(0xffF0F0F0),
  9. double width = 100,
  10. Color backgroundCenter = const Color(0xFFF0F0F0),
  11. required ValueChanged onChange,
  12. int duration = 200,
  13. bool enable = true,
  14. double disableOpacity = 0.6,
  15. double buttonSize = 20,
  16. List values = const [0, 2, 1],
  17. double? height,
  18. 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);