Switch
| Type name | Supports Property Animations | Controlled by default | May contain associated action | Link |
|---|---|---|---|---|
| Switch | ✗ | ✔️ | ✔️ | link |
info
The value stored by the widget can be used as a data source for actions.
Attributes (outdated models)
final class SwitchAttributes extends AttendedModel<bool>
implements DuitAttributes<SwitchAttributes> {
final Color? activeColor,
focusColor,
hoverColor,
activeTrackColor,
inactiveTrackColor;
final WidgetStateProperty<Color>? overlayColor,
trackColor,
thumbColor,
trackOutlineColor;
final WidgetStateProperty<double>? trackOutlineWidth;
final double? splashRadius;
final MaterialTapTargetSize? materialTapTargetSize;
final bool? autofocus;
SwitchAttributes({
required super.value,
this.activeColor,
this.focusColor,
this.hoverColor,
this.activeTrackColor,
this.inactiveTrackColor,
this.overlayColor,
this.trackColor,
this.thumbColor,
this.trackOutlineColor,
this.trackOutlineWidth,
this.splashRadius,
this.materialTapTargetSize,
this.autofocus,
});
Usage
- Go
Switch(
&duit_attributes.SwitchAttributes[duit_color.ColorString]{
Value: false,
},
"id",
&duit_core.RemoteAction{
Event: "/on_change",
DependsOn: []*duit_core.ActionDependency{
{
Id: "id",
Target: "value",
},
},
},
)