11import { VirtualKeyboardButton } from "../virtual_keyboard.slint" ;
2- import { Icons } from "../constants.slint" ;
2+ import { Icons , Constants } from "../constants.slint" ;
33import { StyleMetrics } from "std-widgets.slint" ;
44import { TemperatureSensors } from "../state.slint" ;
5+ import { VerticalStart , VerticalStretch } from "vertical.slint" ;
6+ import { HorizontalStart , HorizontalStretch } from "horizontal.slint" ;
57
68export component NumberPad inherits Rectangle
79{
@@ -28,19 +30,16 @@ export component NumberPad inherits Rectangle
2830 : ceil (current-number / 10 );
2931 }
3032
31- VerticalLayout {
32- spacing: 5px ;
33-
34- HorizontalLayout {
35- spacing: 5px ;
33+ VerticalStretch {
34+ HorizontalStretch {
3635 vertical-stretch: 1 ;
3736
3837 Text {
3938 text: name + ": " + current-number;
4039 horizontal-alignment: center;
4140 vertical-alignment: center;
42- font-size: 20px ;
43- font-weight: 900 ;
41+ font-size: Constants.font-size-lg ;
42+ font-weight: Constants.font-weight-bold ;
4443 horizontal-stretch: 5 ;
4544 }
4645
@@ -49,26 +48,23 @@ export component NumberPad inherits Rectangle
4948 if can_go_negative: VirtualKeyboardButton { key: current-number >= 0 ? "-" : "+" ; key-pressed => { current-number *= -1 ; } }
5049 }
5150
52- HorizontalLayout {
53- spacing: 5px ;
51+ HorizontalStretch {
5452 vertical-stretch: 1 ;
5553 VirtualKeyboardButton { key: "1" ; key-pressed => { add (1 ) } }
5654 VirtualKeyboardButton { key: "2" ; key-pressed => { add (2 ) } }
5755 VirtualKeyboardButton { key: "3" ; key-pressed => { add (3 ) } }
5856 VirtualKeyboardButton { icon: Icons.check; key-pressed => { accept (current-number); current-number = 0 ; } }
5957 }
6058
61- HorizontalLayout {
62- spacing: 5px ;
59+ HorizontalStretch {
6360 vertical-stretch: 1 ;
6461 VirtualKeyboardButton { key: "4" ; key-pressed => { add (4 ) } }
6562 VirtualKeyboardButton { key: "5" ; key-pressed => { add (5 ) } }
6663 VirtualKeyboardButton { key: "6" ; key-pressed => { add (6 ) } }
6764 VirtualKeyboardButton { icon: Icons.close; key-pressed => { cancel (); } }
6865 }
6966
70- HorizontalLayout {
71- spacing: 5px ;
67+ HorizontalStretch {
7268 vertical-stretch: 1 ;
7369 VirtualKeyboardButton { key: "7" ; key-pressed => { add (7 ) } }
7470 VirtualKeyboardButton { key: "8" ; key-pressed => { add (8 ) } }
@@ -94,8 +90,8 @@ export component TemperatureEntry
9490 height: 100% ;
9591
9692 if is_keyboard_open: GridLayout {
97- padding-left: StyleMetrics.layout- padding / 2 ;
98- padding-right: StyleMetrics.layout- padding / 2 ;
93+ padding-left: Constants. padding-half ;
94+ padding-right: Constants. padding-half ;
9995 NumberPad {
10096 name: friendly_temp_device_name;
10197 accept (number) => {
0 commit comments