Fix alignment and size
This commit is contained in:
parent
4d10bffe8b
commit
4529886370
@ -60,74 +60,81 @@ impl WeatherPopup {
|
||||
// Top layout
|
||||
let icon_text = Text::new(icon_to_nerd_font(&icon))
|
||||
.font(font)
|
||||
.size(80)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill)
|
||||
.align_x(Horizontal::Center)
|
||||
.size(88)
|
||||
.height(88)
|
||||
.width(88)
|
||||
.align_x(Horizontal::Left)
|
||||
.align_y(Vertical::Center)
|
||||
.color(Color::WHITE);
|
||||
let icon_block = Column::new()
|
||||
.push(icon_text)
|
||||
.height(Length::Fill)
|
||||
.width(Length::FillPortion(1));
|
||||
let icon_block = Column::new().push(icon_text).height(88).width(88);
|
||||
|
||||
let location_text = Text::new(format!("{city}, {country}"))
|
||||
.font(font)
|
||||
.size(16)
|
||||
.color(Color::WHITE)
|
||||
.align_x(Horizontal::Right)
|
||||
.width(Length::Fill)
|
||||
.height(Length::FillPortion(1));
|
||||
.width(192)
|
||||
.height(26);
|
||||
|
||||
let temp_text = Text::new(temperature)
|
||||
.font(font)
|
||||
.size(40)
|
||||
.size(46)
|
||||
.align_x(Horizontal::Right)
|
||||
.align_y(Vertical::Center)
|
||||
.height(Length::Fill)
|
||||
.height(52)
|
||||
.width(Length::Fill)
|
||||
.color(Color::WHITE);
|
||||
let temp_val_column = Column::new()
|
||||
.push(temp_text)
|
||||
.height(Length::FillPortion(3))
|
||||
.width(Length::Fill);
|
||||
let degree_text = Text::new("O").font(font).size(16).color(Color::WHITE);
|
||||
let temp_val_column = Column::new().push(temp_text).height(52).width(Length::Fill);
|
||||
let degree_text = Text::new("o")
|
||||
.font(font)
|
||||
.size(16)
|
||||
.color(Color::WHITE)
|
||||
.height(23)
|
||||
.align_y(Vertical::Bottom);
|
||||
let unit_text = Text::new(format!("{unit}"))
|
||||
.font(font)
|
||||
.size(16)
|
||||
.color(Color::WHITE);
|
||||
.color(Color::WHITE)
|
||||
.height(23)
|
||||
.align_y(Vertical::Bottom);
|
||||
let unit_block = Column::with_children(vec![
|
||||
Row::new().push(degree_text).height(Length::Fill).into(),
|
||||
Row::new().push(unit_text).height(Length::Fill).into(),
|
||||
Row::new().push(degree_text).height(23).into(),
|
||||
Row::new().push(unit_text).height(23).into(),
|
||||
]);
|
||||
|
||||
let temp_block = Row::new()
|
||||
.push(temp_val_column)
|
||||
.push(Column::new().push(unit_block).height(Length::Fill))
|
||||
.width(Length::Fill);
|
||||
.push(Column::new().push(unit_block).height(52))
|
||||
.align_y(Vertical::Center)
|
||||
.height(52)
|
||||
.width(192);
|
||||
|
||||
let right_block = Column::new()
|
||||
.push(location_text)
|
||||
.push(temp_block)
|
||||
.width(Length::Fill)
|
||||
.width(192)
|
||||
.height(Length::Fill);
|
||||
|
||||
let top_row = Row::new()
|
||||
.push(icon_block)
|
||||
.push(right_block)
|
||||
.width(Length::Fill)
|
||||
.height(Length::FillPortion(8));
|
||||
.height(88);
|
||||
|
||||
// Bottom layout
|
||||
let main_text = Text::new(main)
|
||||
.font(font)
|
||||
.size(16)
|
||||
.size(28)
|
||||
.color(Color::WHITE)
|
||||
.align_y(Vertical::Top)
|
||||
.align_x(Horizontal::Left)
|
||||
.width(Length::FillPortion(3));
|
||||
|
||||
let desc_text = Text::new(desc)
|
||||
.font(font)
|
||||
.size(16)
|
||||
.align_x(Horizontal::Right)
|
||||
.align_y(Vertical::Top)
|
||||
.color(Color::from_rgba(1.0, 1.0, 1.0, 0.8))
|
||||
.width(Length::FillPortion(4));
|
||||
|
||||
@ -135,7 +142,7 @@ impl WeatherPopup {
|
||||
.push(main_text)
|
||||
.push(desc_text)
|
||||
.width(Length::Fill)
|
||||
.height(Length::FillPortion(3));
|
||||
.height(52);
|
||||
|
||||
// Combine
|
||||
let content = Column::new()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user