Skip to content

Toggle

A customizable toggle switch widget for boolean inputs. It provides a switch-style input for boolean values with Cupertino-style design.

The Toggle widget offers a modern and intuitive way to handle on/off states in your application. It supports different states including active, inactive, and read-only, with customizable colors and sizing.

  • States: Active, Inactive, Disabled
  • Styling: Customizable colors and sizing
  • Design: Cupertino-style switch appearance

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.