From d26be9b3dea1323db8152da1eda3d372f953c6d5 Mon Sep 17 00:00:00 2001 From: pml68 Date: Tue, 15 Apr 2025 16:41:46 +0200 Subject: fix: accept `&Class` in `Catalog::style` instead of `Class` --- src/dialog.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/dialog.rs b/src/dialog.rs index 5df75ae..58c3481 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -221,7 +221,6 @@ where where ::Class<'a>: From>, - ::Class<'a>: Into>, { if self.is_open { let contents = Container::new( @@ -278,7 +277,6 @@ where Message: 'a + Clone, ::Class<'a>: From>, - ::Class<'a>: Into>, { fn from(dialog: Dialog<'a, Message, Theme, Renderer>) -> Self { dialog.view() @@ -296,13 +294,12 @@ where Theme: 'a + container::Catalog + Catalog, ::Class<'a>: From>, - ::Class<'a>: Into>, { - let style = class.into(); - let area = mouse_area(center(opaque(content)).style(move |theme| { container::Style { - background: Some(style(theme).backdrop_color.into()), + background: Some( + Catalog::style(theme, &class).backdrop_color.into(), + ), ..Default::default() } })); @@ -336,7 +333,7 @@ pub trait Catalog: text::Catalog + container::Catalog { } /// The [`Style`] of a class. - fn style(&self, class: ::Class<'_>) -> Style; + fn style(&self, class: &::Class<'_>) -> Style; } /// A styling function for a [`Dialog`]. @@ -357,7 +354,7 @@ impl Catalog for Theme { }) } - fn style(&self, class: ::Class<'_>) -> Style { + fn style(&self, class: &::Class<'_>) -> Style { class(self) } } -- cgit v1.2.3