1786206156

This commit is contained in:
2026-08-08 18:22:36 +02:00
parent dcf9e6c970
commit c255980dc6

View File

@@ -18,6 +18,8 @@ import {
Switch,
MaterialStyleMetrics,
MaterialPalette,
ElevatedButton,
FilledButton,
} from "material/material.slint";
import { Icons } from "material/ui/icons/icons.slint";
@@ -97,32 +99,49 @@ component LightTile inherits Rectangle {
in property <LightData> light;
callback clicked();
TouchArea {
clicked => {
clicked();
}
if light.on: FilledButton {
width: 100%;
text: light.name;
enabled: light.available;
// background: light.on;
clicked => root.clicked();
}
HorizontalLayout {
spacing: MaterialStyleMetrics.padding_8;
Text {
text: light.name;
height: 32px;
vertical-alignment: center;
horizontal-alignment: right;
// font-weight: light.on ? 700 : 500;
color: light.on ? MaterialPalette.primary : MaterialPalette.secondary;
font-size: 18px;
}
sw := Switch {
width: 48px;
height: 32px;
enabled: light.available;
checked: light.on;
checked_state_changed(checked) => { root.clicked() }
}
if !light.on: ElevatedButton {
width: 100%;
text: light.name;
enabled: light.available;
// background: light.on;
clicked => root.clicked();
}
// HorizontalLayout {
// TouchArea {
// clicked => {
// clicked();
// }
// }
// spacing: MaterialStyleMetrics.padding_8;
// Text {
// text: light.name;
// height: 32px;
// vertical-alignment: center;
// horizontal-alignment: right;
// // font-weight: light.on ? 700 : 500;
// color: light.on ? MaterialPalette.primary : MaterialPalette.secondary;
// font-size: 18px;
// }
// sw := Switch {
// width: 48px;
// height: 32px;
// enabled: light.available;
// checked: light.on;
// checked_state_changed(checked) => { root.clicked() }
// }
// }
}
export component AppWindow inherits Window {