Added box layouts

This commit is contained in:
Jarrod Doyle 2024-04-10 11:46:53 +01:00
parent a13ef6e15d
commit 1065e104da
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 43 additions and 0 deletions

43
ui/widgets/layout.slint Normal file
View File

@ -0,0 +1,43 @@
import {Metrics, DarkPalette} from "../theme.slint";
struct BorderStyle {
border-width: length,
border-color: brush,
border-radius: length,
}
export component HorizontalBox inherits Rectangle {
// TODO: border, shadow
in property <length> j-rounding: 0px;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: start;
background: DarkPalette.background[1];
border-radius: j-rounding;
HorizontalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
@children
}
}
export component VerticalBox inherits Rectangle {
// TODO: border, shadow
in property <length> j-rounding: 0px;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: start;
background: DarkPalette.background[1];
border-radius: j-rounding;
VerticalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
@children
}
}