Change layout
- Change to grid layout with rows
This commit is contained in:
parent
92db45bb28
commit
5df38a8b63
@ -74,7 +74,7 @@ fn set_ui_props(ui: &MainWindow, resp: &WeatherResponse, cfg: &Config) {
|
|||||||
ui.window().set_size(LogicalSize::new(300.0, 124.0));
|
ui.window().set_size(LogicalSize::new(300.0, 124.0));
|
||||||
|
|
||||||
// Window position (x,y): pixels
|
// Window position (x,y): pixels
|
||||||
ui.window().set_position(LogicalPosition::new(1610.0, 32.0));
|
ui.window().set_position(LogicalPosition::new(1055.0, 32.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create and show the Window UI
|
/// Create and show the Window UI
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export component MainWindow inherits Window {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
default-font-family: "IosevkaTermSlab Nerd Font Mono";
|
default-font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
|
||||||
weather_popup := Rectangle {
|
Rectangle {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@ -23,78 +23,67 @@ export component MainWindow inherits Window {
|
|||||||
drop-shadow-blur: 15px;
|
drop-shadow-blur: 15px;
|
||||||
drop-shadow-color: #00000066;
|
drop-shadow-color: #00000066;
|
||||||
|
|
||||||
VerticalLayout {
|
GridLayout {
|
||||||
spacing: 2px; // Consistent vertical spacing
|
padding: 12px;
|
||||||
horizontal-stretch: 1.0;
|
// Top row
|
||||||
padding: 12px; // Consistent padding throughout
|
Row {
|
||||||
|
|
||||||
/* Top: City */
|
|
||||||
Text {
|
|
||||||
text: city + ", " + country;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
//font-family:
|
|
||||||
horizontal-alignment: TextHorizontalAlignment.left;
|
|
||||||
height: 18px; // Fixed height for consistent spacing
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Middle: icon on left, temp on right */
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
horizontal-stretch: 1.0;
|
// Left column - weather icon
|
||||||
height: 50px; // Fixed height for main content area
|
Rectangle {
|
||||||
padding: 0px;
|
width: 80px;
|
||||||
|
|
||||||
/* Icon */
|
|
||||||
Text {
|
Text {
|
||||||
text: weather_icon;
|
text: weather_icon;
|
||||||
font-size: 40px;
|
font-size: 80px;
|
||||||
horizontal-alignment: TextHorizontalAlignment.left;
|
color: #ffffff;
|
||||||
color: #fff;
|
horizontal-alignment: center;
|
||||||
vertical-alignment: TextVerticalAlignment.center;
|
vertical-alignment: center;
|
||||||
width: 46px; // Fixed width for consistent alignment
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flexible spacer to help with alignment */
|
// Right column
|
||||||
Rectangle {
|
Rectangle {
|
||||||
horizontal-stretch: 1.0;
|
VerticalLayout {
|
||||||
background: transparent;
|
alignment: end;
|
||||||
|
// City name
|
||||||
|
Text {
|
||||||
|
text: city + "," + country;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #fff;
|
||||||
|
horizontal-alignment: right;
|
||||||
|
height: 18px;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
// Temperature block
|
||||||
/* Temperature group */
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
spacing: 4px; // Tighter spacing for temperature elements
|
// Temperatur value
|
||||||
padding: 0px;
|
Rectangle {
|
||||||
//height: 50px;
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: temperature;
|
text: temperature;
|
||||||
|
color: #ffffff;
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
color: #fff;
|
horizontal-alignment: right;
|
||||||
vertical-alignment: TextVerticalAlignment.center;
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Temperature unit
|
||||||
|
Rectangle {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
height: 50px; // Match temperature text height
|
// The degree symbol
|
||||||
padding: 0px;
|
|
||||||
spacing: 0px;
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "o";
|
text: "o";
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
horizontal-alignment: TextHorizontalAlignment.left;
|
horizontal-alignment: left;
|
||||||
vertical-alignment: TextVerticalAlignment.center;
|
vertical-alignment: center;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
// Unit symbol
|
||||||
Text {
|
Text {
|
||||||
text: unit;
|
text: unit;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
horizontal-alignment: TextHorizontalAlignment.left;
|
horizontal-alignment: left;
|
||||||
vertical-alignment: TextVerticalAlignment.center;
|
vertical-alignment: center;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
@ -102,25 +91,23 @@ export component MainWindow inherits Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Bottom: summary + description */
|
// Bottom row
|
||||||
HorizontalLayout {
|
Row {
|
||||||
spacing: 8px;
|
|
||||||
horizontal-stretch: 1.0;
|
|
||||||
height: 32px;
|
|
||||||
padding: 0px;
|
|
||||||
|
|
||||||
/* Summary */
|
/* Summary */
|
||||||
Text {
|
Text {
|
||||||
text: weather_main;
|
text: weather_main;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
vertical-alignment: TextVerticalAlignment.top;
|
vertical-alignment: top;
|
||||||
horizontal-alignment: TextHorizontalAlignment.left;
|
horizontal-alignment: left;
|
||||||
width: 40%; // Fixed percentage width for consistent layout
|
width: 40%; // Fixed percentage width for consistent layout
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Description */
|
/* Description */
|
||||||
Text {
|
Text {
|
||||||
text: weather_description;
|
text: weather_description;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user