RothkoToggle constructor
RothkoToggle({
- Key? key,
- required bool value,
- required ValueChanged<
bool> onToggle, - Color activeColor = RothkoColor.kPrimaryBase,
- Color inactiveColor = RothkoColor.kLightNeutralDarken2,
- Color toggleColor = RothkoColor.kLightNeutralLighten2,
- Color? activeToggleColor,
- Color? inactiveToggleColor,
- double width = 55.0,
- double height = 32.0,
- double toggleSize = 25.0,
- double valueFontSize = 16.0,
- double borderRadius = 20.0,
- double padding = 4.0,
- bool showOnOff = false,
- String? inactiveText,
- FontWeight? activeTextFontWeight,
- FontWeight? inactiveTextFontWeight,
- BoxBorder? switchBorder,
- BoxBorder? activeSwitchBorder,
- BoxBorder? inactiveSwitchBorder,
- BoxBorder? toggleBorder,
- BoxBorder? activeToggleBorder,
- BoxBorder? inactiveToggleBorder,
- Widget? activeIcon,
- Widget? inactiveIcon,
- Duration duration = const Duration(milliseconds: 200),
- bool disabled = false,
- bool? isReadOnly,
Creates a material design switch.
The following arguments are required:
Implementation
RothkoToggle({
Key? key,
required this.value,
required this.onToggle,
this.activeColor = RothkoColor.kPrimaryBase,
this.inactiveColor = RothkoColor.kLightNeutralDarken2,
this.toggleColor = RothkoColor.kLightNeutralLighten2,
this.activeToggleColor,
this.inactiveToggleColor,
this.width = 55.0,
this.height = 32.0,
this.toggleSize = 25.0,
this.valueFontSize = 16.0,
this.borderRadius = 20.0,
this.padding = 4.0,
this.showOnOff = false,
this.inactiveText,
this.activeTextFontWeight,
this.inactiveTextFontWeight,
this.switchBorder,
this.activeSwitchBorder,
this.inactiveSwitchBorder,
this.toggleBorder,
this.activeToggleBorder,
this.inactiveToggleBorder,
this.activeIcon,
this.inactiveIcon,
this.duration = const Duration(milliseconds: 200),
this.disabled = false,
this.isReadOnly,
}) : assert(
(switchBorder == null || activeSwitchBorder == null) &&
(switchBorder == null || inactiveSwitchBorder == null),
'Cannot provide switchBorder when an activeSwitchBorder or inactiveSwitchBorder was given\n'
'To give the switch a border, use "activeSwitchBorder: border" or "inactiveSwitchBorder: border".'),
assert(
(toggleBorder == null || activeToggleBorder == null) &&
(toggleBorder == null || inactiveToggleBorder == null),
'Cannot provide toggleBorder when an activeToggleBorder or inactiveToggleBorder was given\n'
'To give the toggle a border, use "activeToggleBorder: color" or "inactiveToggleBorder: color".'),
super(key: key);