Popup UI basic design
- Design popup UI with slint
This commit is contained in:
parent
d83c5a0aca
commit
aa4cf1a686
@ -1,41 +1,118 @@
|
|||||||
export component MainWindow inherits Window {
|
export component MainWindow inherits Window {
|
||||||
always-on-top: true;
|
always-on-top: true;
|
||||||
height: 100px;
|
|
||||||
width: 300px;
|
|
||||||
no-frame: true;
|
no-frame: true;
|
||||||
|
width: 320px;
|
||||||
|
height: 110px;
|
||||||
|
background: transparent;
|
||||||
|
|
||||||
weather_popup := Rectangle {
|
weather_popup := Rectangle {
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 10px;
|
height: 100%;
|
||||||
border-color: #ffffff00;
|
padding: 10px; // keep content inset from edges
|
||||||
background: #7e7e7e36;
|
border-radius: 14px;
|
||||||
|
border-color: #ffffff22;
|
||||||
|
border-width: 1px;
|
||||||
|
background: @linear-gradient(135deg, #ffffff18, #7e7e7e24);
|
||||||
|
drop-shadow-blur: 10px;
|
||||||
|
drop-shadow-color: #00000066;
|
||||||
|
|
||||||
main_temp := Text {text: "24.4" + "°C";
|
VerticalLayout {
|
||||||
vertical-alignment: TextVerticalAlignment.center;
|
spacing: 6px;
|
||||||
x: 10px;
|
horizontal-stretch: 1.0;
|
||||||
y: 10px;
|
padding: 10px;
|
||||||
color: #ffffff;
|
|
||||||
|
/* Top: City */
|
||||||
|
Text {
|
||||||
|
text: "Los Angeles";
|
||||||
|
font-size: 14px;
|
||||||
|
color: #fff;
|
||||||
|
font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Middle: icon on left, temp on right */
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 8px;
|
||||||
|
horizontal-stretch: 1.0;
|
||||||
|
|
||||||
|
/* Icon (fixed size) */
|
||||||
|
Text {
|
||||||
|
text: "";
|
||||||
font-family: "IosevkaTermSlab Nerd Font Mono";
|
font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
|
color: #fff;
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
}
|
}
|
||||||
|
|
||||||
weather_summary := Text {
|
/* flexible spacer pushes the temperature group to the right */
|
||||||
text: "Clear";
|
Rectangle {
|
||||||
x: 10px;
|
horizontal-stretch: 1.0;
|
||||||
y: 55px;
|
background: transparent;
|
||||||
font-size: 30px;
|
|
||||||
font-family: "IosevkaTermSlab Nerd Font Mono";
|
|
||||||
color: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
city_name := Text {
|
/* Temperature group (numeric + degree/unit) */
|
||||||
text: "England";
|
HorizontalLayout {
|
||||||
x: 150px;
|
spacing: 6px;
|
||||||
y: 55px;
|
//vertical-alignment: TextVerticalAlignment.center;
|
||||||
font-size: 25px;
|
|
||||||
|
Text {
|
||||||
|
text: "124.4";
|
||||||
font-family: "IosevkaTermSlab Nerd Font Mono";
|
font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
font-size: 40px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalLayout {
|
||||||
|
spacing: -6px; // bring degree and unit closer to the number
|
||||||
|
// keep the combined height near the numeric height
|
||||||
|
Text {
|
||||||
|
text: "°";
|
||||||
|
font-size: 20px;
|
||||||
|
color: #fff;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
vertical-alignment: TextVerticalAlignment.bottom;
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: "F";
|
||||||
|
font-size: 18px;
|
||||||
|
color: #fff;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
vertical-alignment: TextVerticalAlignment.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bottom: summary (left) + description (right).
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 10px;
|
||||||
|
horizontal-stretch: 1.0;
|
||||||
|
height: 28px;
|
||||||
|
|
||||||
|
// Summary (left) — single prominent line, vertically centered
|
||||||
|
Text {
|
||||||
|
text: "Thunderstorm";
|
||||||
|
font-size: 22px;
|
||||||
|
color: #fff;
|
||||||
|
font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.left;
|
||||||
|
// width can be fixed or let text size itself
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description (right) — can take remaining width and occupy same height
|
||||||
|
Text {
|
||||||
|
text: "Thunderstorm with heavy drizzle";
|
||||||
|
font-size: 13px;
|
||||||
|
color: #ffffffcc;
|
||||||
|
font-family: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.left;
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
|
horizontal-stretch: 1.0;
|
||||||
|
wrap: word-wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user