From 1065e104dada2e74f956f715b1106d7ef0db81e4 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Wed, 10 Apr 2024 11:46:53 +0100 Subject: [PATCH] Added box layouts --- ui/widgets/layout.slint | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ui/widgets/layout.slint diff --git a/ui/widgets/layout.slint b/ui/widgets/layout.slint new file mode 100644 index 0000000..385867e --- /dev/null +++ b/ui/widgets/layout.slint @@ -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 j-rounding: 0px; + in property j-padding: Metrics.padding-md; + in property j-spacing: Metrics.spacing-md; + in property 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 j-rounding: 0px; + in property j-padding: Metrics.padding-md; + in property j-spacing: Metrics.spacing-md; + in property j-alignment: start; + + background: DarkPalette.background[1]; + border-radius: j-rounding; + + VerticalLayout { + alignment: j-alignment; + padding: j-padding; + spacing: j-spacing; + @children + } +}