From e2b00f98a0fab96da6502610b135a4c86fbd63b5 Mon Sep 17 00:00:00 2001 From: PolyMeilex Date: Sat, 8 Jun 2024 02:09:10 +0200 Subject: [PATCH] Allow for styling of the menu of a pick list --- widget/src/pick_list.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index edccfdaaa6..97de5b486e 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -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 + ::Class<'a>: From>, + { + 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<::Class<'a>>, + ) -> Self { + self.menu_class = class.into(); + self + } } impl<'a, T, L, V, Message, Theme, Renderer> Widget