Skip to content

Commit bda0156

Browse files
authored
Merge pull request #2457 from PolyMeilex/pick-list-menu-style
Allow for styling of the menu of a pick list
2 parents 49affc4 + e2b00f9 commit bda0156

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

widget/src/pick_list.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ where
161161
self
162162
}
163163

164+
/// Sets the style of the [`Menu`].
165+
#[must_use]
166+
pub fn menu_style(
167+
mut self,
168+
style: impl Fn(&Theme) -> menu::Style + 'a,
169+
) -> Self
170+
where
171+
<Theme as menu::Catalog>::Class<'a>: From<menu::StyleFn<'a, Theme>>,
172+
{
173+
self.menu_class = (Box::new(style) as menu::StyleFn<'a, Theme>).into();
174+
self
175+
}
176+
164177
/// Sets the style class of the [`PickList`].
165178
#[cfg(feature = "advanced")]
166179
#[must_use]
@@ -171,6 +184,17 @@ where
171184
self.class = class.into();
172185
self
173186
}
187+
188+
/// Sets the style class of the [`Menu`].
189+
#[cfg(feature = "advanced")]
190+
#[must_use]
191+
pub fn menu_class(
192+
mut self,
193+
class: impl Into<<Theme as menu::Catalog>::Class<'a>>,
194+
) -> Self {
195+
self.menu_class = class.into();
196+
self
197+
}
174198
}
175199

176200
impl<'a, T, L, V, Message, Theme, Renderer> Widget<Message, Theme, Renderer>

0 commit comments

Comments
 (0)