Toggle
Overview
A toggle is used to quickly switch between two possible states. They are commonly used for “on/off” switches.

Widget API
Property
Description
onToggle
Called when the value of the toggle change. This callback passes the new value, but doesn't update its state internally.
Type:
void Function(bool value)Default: required
enable
Whether the toggle is enabled or not.
Type:
boolDefault:
true
value
Whether the initial value of the toggle is checked or not.
Type:
boolDefault:
true
labelText
The labelText of this toggle.
Type:
String?Default: optional
size
The size of this toggle. It can be md or sm.
Type:
CToggleSizeDefault:
CToggleSize.md
showStatusLabel
Whether the toggle should display its status (On | Off) or not.
Type:
boolDefault:
true
Example
CToggle(
onToggle: (v) {},
value: true,
labelText: 'Label text',
showStatusLabel: true,
size: CToggleSize.sm,
)Last updated
Was this helpful?