WidgetSwitch2 constructor

WidgetSwitch2({
  1. Key? key,
  2. Color colorLeftBackground = Colors.red,
  3. double disableOpacity = 0.6,
  4. Color colorRightBackground = Colors.green,
  5. Color colorButton = const Color(0xffF0F0F0),
  6. double width = 100,
  7. Color backgroundCenter = const Color(0xFFF0F0F0),
  8. required ValueChanged onChange,
  9. int duration = 200,
  10. double buttonSize = 25,
  11. bool enable = true,
  12. String textLeft = "Off",
  13. String textRight = "On",
  14. List values = const [0, 2, 1],
  15. 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);