Перейти к основному содержимому

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,
});

Пример использования​

Switch(
&duit_attributes.SwitchAttributes[duit_color.ColorString]{
Value: false,
},
"id",
&duit_core.RemoteAction{
Event: "/on_change",
DependsOn: []*duit_core.ActionDependency{
{
Id: "id",
Target: "value",
},
},
},
)