Switch
| Название типа | Поддерживает анимации свойств | Контроллируемый по умолчанию | Может содержать связанное действие | Ссылка |
|---|---|---|---|---|
| Switch | ✗ | ✔️ | ✔️ | link |
к сведению
Значение, хранимое виджетом, может быть использовано в качестве источника данных для действий.
Атрибуты (устаревшие модели)
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,
});
Пример использования
- 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",
},
},
},
)