TKeyValue.toggle constructor
TKeyValue.toggle(})
Creates a key-value item for displaying and editing boolean values using TSwitch.
Implementation
factory TKeyValue.toggle(
String key,
bool? value, {
ValueChanged<bool?>? onValueChanged,
bool disabled = false,
TInputSize size = TInputSize.sm,
Color? color,
Color? inactiveColor,
Widget? icon,
double? width,
Alignment? alignment,
double? minWidth,
double? maxWidth,
}) {
Widget? widget;
if (value != null) {
widget = TSwitch(
value: value,
disabled: disabled,
size: size,
color: color,
inactiveColor: inactiveColor,
onValueChanged: disabled ? null : onValueChanged,
);
}
return TKeyValue(
key,
value: value?.toString(),
widget: widget,
icon: icon,
width: width,
alignment: alignment,
minWidth: minWidth,
maxWidth: maxWidth,
);
}