From b7aed0e4d6a5caf66c70bc2d44e00070f4d87d4e Mon Sep 17 00:00:00 2001 From: UchiWerfer <87275644+UchiWerfer@users.noreply.github.com> Date: Fri, 16 May 2025 17:02:16 +0200 Subject: [PATCH] feat(calendar): add first day of week parameter --- src/widget/calendar.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widget/calendar.rs b/src/widget/calendar.rs index 046a95d..07d0d0b 100644 --- a/src/widget/calendar.rs +++ b/src/widget/calendar.rs @@ -15,12 +15,14 @@ pub fn calendar( on_select: impl Fn(NaiveDate) -> M + 'static, on_prev: impl Fn() -> M + 'static, on_next: impl Fn() -> M + 'static, + first_day_of_week: Weekday ) -> Calendar { Calendar { model, on_select: Box::new(on_select), on_prev: Box::new(on_prev), on_next: Box::new(on_next), + first_day_of_week } } @@ -105,6 +107,7 @@ pub struct Calendar<'a, M> { on_select: Box M>, on_prev: Box M>, on_next: Box M>, + first_day_of_week: Weekday } impl<'a, Message> From> for crate::Element<'a, Message> @@ -130,7 +133,7 @@ where let mut calendar_grid: Grid<'_, Message> = grid().padding([0, 12].into()).width(Length::Fill); - let mut first_day_of_week = Weekday::Sun; // TODO: Configurable + let mut first_day_of_week = this.first_day_of_week; for _ in 0..7 { calendar_grid = calendar_grid.push( text(first_day_of_week.to_string())