FlutterSwitch constructor
const
FlutterSwitch({
- Key? key,
- required bool value,
- required ValueChanged<
bool> onToggle, - String? activeText = "On",
- String? inactiveText = "Off",
- Color activeColor = Colors.blue,
- Color inactiveColor = Colors.grey,
- Color activeTextColor = Colors.white70,
- Color inactiveTextColor = Colors.white70,
- FontWeight activeTextFontWeight = FontWeight.w900,
- FontWeight inactiveTextFontWeight = FontWeight.w900,
- Color toggleColor = Colors.white,
- Color? activeToggleColor,
- Color? inactiveToggleColor,
- double width = 70.0,
- double height = 35.0,
- double toggleSize = 25.0,
- double valueFontSize = 12.0,
- double borderRadius = 20.0,
- double padding = 4.0,
- bool showOnOff = false,
- Duration duration = const Duration(milliseconds: 200),
- bool disabled = false,
- Widget? activeIcon,
- Widget? inactiveIcon,
- BoxBorder? switchBorder,
- 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,
});