Start styling
- Basic coloring and layouts
This commit is contained in:
parent
3540f8d75a
commit
280651a64d
@ -1,4 +1,5 @@
|
|||||||
use iced::{
|
use iced::{
|
||||||
|
application::Appearance, Color,
|
||||||
Alignment, Font, Length, Point, Settings, Size, Task,
|
Alignment, Font, Length, Point, Settings, Size, Task,
|
||||||
alignment::{Horizontal, Vertical},
|
alignment::{Horizontal, Vertical},
|
||||||
font::Family,
|
font::Family,
|
||||||
@ -27,7 +28,6 @@ impl WeatherPopup {
|
|||||||
|
|
||||||
fn view(&self) -> iced::Element<Message> {
|
fn view(&self) -> iced::Element<Message> {
|
||||||
// Data
|
// Data
|
||||||
let default_font = "IosevkaTermSlab Nerd Font Mono";
|
|
||||||
let city = self.resp.name.clone().unwrap_or_else(|| "Unknown".into());
|
let city = self.resp.name.clone().unwrap_or_else(|| "Unknown".into());
|
||||||
let country = self
|
let country = self
|
||||||
.resp
|
.resp
|
||||||
@ -51,6 +51,7 @@ impl WeatherPopup {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
|
let default_font = "IosevkaTermSlab Nerd Font Mono";
|
||||||
column![
|
column![
|
||||||
// City and country
|
// City and country
|
||||||
Row::with_children(vec![
|
Row::with_children(vec![
|
||||||
@ -60,6 +61,7 @@ impl WeatherPopup {
|
|||||||
..Font::DEFAULT
|
..Font::DEFAULT
|
||||||
})
|
})
|
||||||
.size(16)
|
.size(16)
|
||||||
|
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
@ -72,6 +74,7 @@ impl WeatherPopup {
|
|||||||
})
|
})
|
||||||
.align_x(Horizontal::Left)
|
.align_x(Horizontal::Left)
|
||||||
.size(40)
|
.size(40)
|
||||||
|
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||||
.into(),
|
.into(),
|
||||||
Space::with_width(Length::Fill).into(),
|
Space::with_width(Length::Fill).into(),
|
||||||
Text::new(format!("{temperature}°{unit}"))
|
Text::new(format!("{temperature}°{unit}"))
|
||||||
@ -80,6 +83,7 @@ impl WeatherPopup {
|
|||||||
..Font::DEFAULT
|
..Font::DEFAULT
|
||||||
})
|
})
|
||||||
.size(32)
|
.size(32)
|
||||||
|
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
@ -91,6 +95,7 @@ impl WeatherPopup {
|
|||||||
..Font::DEFAULT
|
..Font::DEFAULT
|
||||||
})
|
})
|
||||||
.size(16)
|
.size(16)
|
||||||
|
.color(Color::from_rgb(1.0, 1.0, 1.0))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
@ -117,6 +122,13 @@ pub fn show_popup(resp: WeatherResponse, conf: owm_widg_config::config::Config)
|
|||||||
decorations: false,
|
decorations: false,
|
||||||
..window::Settings::default()
|
..window::Settings::default()
|
||||||
})
|
})
|
||||||
|
.style(|_state, _theme| {
|
||||||
|
Appearance {
|
||||||
|
background_color: Color::from_rgba(0.1, 0.1, 0.1, 0.25),
|
||||||
|
text_color: Color::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
.run_with(move || (WeatherPopup::new(resp, conf), Task::none()))
|
.run_with(move || (WeatherPopup::new(resp, conf), Task::none()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user