SwitchWidget
The SwitchWidget
is a toggle button that switches between an ON and OFF state. It supports custom textures, event callbacks, and dynamic state updates.
Features
- Toggle button behavior – Click to switch between ON and OFF.
- Event handling – Fires callbacks when the switch state changes.
Properties
Field | Type | Description |
---|---|---|
isPressed |
boolean (default: false) |
Current switch state. |
APIs
setPressed
Sets the ON/OFF state of the switch.
- Triggers UI updates and event callbacks.
setOnPressCallback
Registers a callback when the switch is clicked.
setSupplier
Automatically syncs with an external state.
- Updates dynamically when
getCurrentState()
changes.