adapt to latest iced (555ee3e9c66010c9a90c3ef55d61fbffd48e669d)

This commit is contained in:
Fabrizio Iannetti 2024-07-26 20:34:23 +02:00
parent cd9d710d14
commit e2fd0c4d08
3 changed files with 18 additions and 8 deletions

View File

@ -89,7 +89,7 @@ impl CalendarApp {
#[cfg(feature = "tracing")]
tracepoints::calendar::view_entry();
let content = Column::new()
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.push(self.controls.view(self.view_date))
.push(CalendarView::new(self.controls.mode.unwrap_or(ViewMode::Year), &CalendarParams::new(), self.view_date, &self.events))
;

View File

@ -3,7 +3,7 @@ mod app;
mod ui;
mod model;
use app::{CalendarApp, Message};
use app::CalendarApp;
use iced::Task;
use std::path;
use clap::Parser;

View File

@ -7,7 +7,17 @@ use chrono::{
NaiveDate,
Locale,
};
use iced::{Alignment, Background, Border, Element, Length, Theme, alignment, theme::palette, widget::{Button, Row, Text, button::{Status, Style, secondary}, row, text}};
use iced::{
Alignment,
Background,
Element,
Length,
Theme,
alignment,
theme::palette,
border,
widget::{Button, Row, Text, button::{Status, Style, secondary}, row, text}
};
//#[derive(Default)]
pub struct Controls {
@ -32,7 +42,7 @@ impl Controls {
_ => "".to_string()
};
Row::new()
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.padding(5)
.spacing(10)
.push(row![
@ -48,13 +58,13 @@ impl Controls {
.push(
Text::new(description)
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Left)
.align_x(alignment::Horizontal::Left)
.size(24),
)
.push(
Text::new(view_date.year().to_string())
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Right)
.align_x(alignment::Horizontal::Right)
.size(40),
)
.into()
@ -96,7 +106,7 @@ fn styled(pair: palette::Pair) -> Style {
Style {
background: Some(Background::Color(pair.color)),
text_color: pair.text,
border: Border::rounded(2),
border: border::rounded(2),
..Style::default()
}
}