FlutterSwitch constructor

const FlutterSwitch({
  1. Key? key,
  2. required bool value,
  3. required ValueChanged<bool> onToggle,
  4. String? activeText = "On",
  5. String? inactiveText = "Off",
  6. Color activeColor = Colors.blue,
  7. Color inactiveColor = Colors.grey,
  8. Color activeTextColor = Colors.white70,
  9. Color inactiveTextColor = Colors.white70,
  10. FontWeight activeTextFontWeight = FontWeight.w900,
  11. FontWeight inactiveTextFontWeight = FontWeight.w900,
  12. Color toggleColor = Colors.white,
  13. Color? activeToggleColor,
  14. Color? inactiveToggleColor,
  15. double width = 70.0,
  16. double height = 35.0,
  17. double toggleSize = 25.0,
  18. double valueFontSize = 12.0,
  19. double borderRadius = 20.0,
  20. double padding = 4.0,
  21. bool showOnOff = false,
  22. Duration duration = const Duration(milliseconds: 200),
  23. bool disabled = false,
  24. Widget? activeIcon,
  25. Widget? inactiveIcon,
  26. BoxBorder? switchBorder,
  27. BoxBorder? toggleBorder,
})

Implementation

const FlutterSwitch({
  super.key,
  required this.value,
  required this.onToggle,
  this.activeText = "On",
  this.inactiveText = "Off",
  this.activeColor = Colors.blue,
  this.inactiveColor = Colors.grey,
  this.activeTextColor = Colors.white70,
  this.inactiveTextColor = Colors.white70,
  this.activeTextFontWeight = FontWeight.w900,
  this.inactiveTextFontWeight = FontWeight.w900,
  this.toggleColor = Colors.white,
  this.activeToggleColor,
  this.inactiveToggleColor,
  this.width = 70.0,
  this.height = 35.0,
  this.toggleSize = 25.0,
  this.valueFontSize = 12.0,
  this.borderRadius = 20.0,
  this.padding = 4.0,
  this.showOnOff = false,
  this.duration = const Duration(milliseconds: 200),
  this.disabled = false,
  this.activeIcon,
  this.inactiveIcon,
  this.switchBorder,
  this.toggleBorder,
});