Fix alignment and size

This commit is contained in:
Candifloss 2025-11-11 11:28:04 +05:30
parent 4d10bffe8b
commit 4529886370

View File

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