Merge pull request #2457 from PolyMeilex/pick-list-menu-style

Allow for styling of the menu of a pick list
This commit is contained in:
Héctor Ramón 2024-06-10 23:03:02 +02:00 committed by GitHub
commit bda01567d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -161,6 +161,19 @@ where
self
}
/// Sets the style of the [`Menu`].
#[must_use]
pub fn menu_style(
mut self,
style: impl Fn(&Theme) -> menu::Style + 'a,
) -> Self
where
<Theme as menu::Catalog>::Class<'a>: From<menu::StyleFn<'a, Theme>>,
{
self.menu_class = (Box::new(style) as menu::StyleFn<'a, Theme>).into();
self
}
/// Sets the style class of the [`PickList`].
#[cfg(feature = "advanced")]
#[must_use]
@ -171,6 +184,17 @@ where
self.class = class.into();
self
}
/// Sets the style class of the [`Menu`].
#[cfg(feature = "advanced")]
#[must_use]
pub fn menu_class(
mut self,
class: impl Into<<Theme as menu::Catalog>::Class<'a>>,
) -> Self {
self.menu_class = class.into();
self
}
}
impl<'a, T, L, V, Message, Theme, Renderer> Widget<Message, Theme, Renderer>