Skip to content

Toggle

A Toggle is a control that lets users switch between two opposing states, such as on/off or enabled/disabled.

Use Toggles for settings or actions that take immediate effect and don’t require confirmation, ideal for preferences, system options, or feature flags.

Common alternative names:
Switch


Toggle in the active/on state.


Toggle in the inactive/off state.


Toggle that cannot be interacted with.


Toggle with increased size for better visibility.


PropertyTypeDescription
valueboolRequired. Current state of the toggle (true for active, false for inactive).
onChangedvoid Function(bool)?Callback when toggle state changes. If null, toggle is disabled.
readOnlyboolWhether toggle is read-only and cannot be interacted with. Default: false.
sizedoubleSize factor for scaling the toggle from base size of 15. Default: 10.
thumbColorColor?Color of the toggle thumb (circular moving part). Default: Colors.white.
activeTrackColorColor?Color of the track when toggle is active. Uses theme accent color if not provided.
inactiveTrackColorColor?Color of the track when toggle is inactive. Uses default Cupertino color if not provided.