The StacDocumentation Index
Fetch the complete documentation index at: https://docs.stac.dev/llms.txt
Use this file to discover all available pages before exploring further.
Switch widget allows you to build the Flutter Switch widget using JSON.
To know more about the Switch widget in Flutter, refer to the official documentation.
Properties
| Property | Type | Description |
|---|---|---|
| switchType | StacSwitchType | The type of the Switch. |
| value | bool | Whether this switch is on or off. |
| onChanged | StacAction | Called when the user toggles the switch on or off. |
| autofocus | bool | True if this widget will be selected as the initial focus when no other node in its scope is currently focused. |
| activeThumbColor | StacColor | The color to use when this switch is on. |
| activeTrackColor | StacColor | The color to use on the track when this switch is on. |
| focusColor | StacColor | The color for the button’s when it has the input focus. |
| hoverColor | StacColor | The color for the button’s when a pointer is hovering over it. |
| inactiveThumbColor | StacColor | The color to use on the thumb when this switch is off. |
| inactiveTrackColor | StacColor | The color to use on the track when this switch is off. |
| onLabelColor | StacColor | The color to use for the accessibility label when the switch is on. |
| offLabelColor | StacColor | The color to use for the accessibility label when the switch is off. |
| splashRadius | double | The splash radius of the circular ink response. |
| dragStartBehavior | StacDragStartBehavior | Determines the way that drag start behavior is handled. |
| overlayColor | StacMaterialColor | The color for the switch. |
| thumbColor | StacMaterialColor | The color of this Switch’s thumb. |
| trackColor | StacMaterialColor | TThe color of this Switch’s track. |
| materialTapTargetSize | StacMaterialTapTargetSize | Configures the minimum size of the tap target. |
| trackOutlineColor | StacMaterialColor | The outline color of this Switch’s track. |
| thumbIcon | StacWidget | The icon to use on the thumb of this switch. |
| inactiveThumbImage | String | An image to use on the thumb of this switch when the switch is off. |
| activeThumbImage | String | An image to use on the thumb of this switch when the switch is on. |
| applyTheme | bool | Whether to apply the ambient theme data. |
| applyCupertinoTheme | bool | Whether to apply the ambient theme data. |
Example
Example 1: Cupertino Switch
- Dart
- JSON
- Preview