Add menu_height method to pick_list and combo_box

This commit is contained in:
GyulyVGC 2024-12-17 23:36:39 +01:00 committed by Héctor Ramón Jiménez
parent 9ef65db8c9
commit 71a4dff703
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 23 additions and 1 deletions

View file

@ -173,6 +173,7 @@ pub struct PickList<
class: <Theme as Catalog>::Class<'a>,
menu_class: <Theme as menu::Catalog>::Class<'a>,
last_status: Option<Status>,
menu_height: Length,
}
impl<'a, T, L, V, Message, Theme, Renderer>
@ -209,6 +210,7 @@ where
class: <Theme as Catalog>::default(),
menu_class: <Theme as Catalog>::default_menu(),
last_status: None,
menu_height: Length::Shrink,
}
}
@ -224,6 +226,12 @@ where
self
}
/// Sets the height of the [`Menu`].
pub fn menu_height(mut self, menu_height: impl Into<Length>) -> Self {
self.menu_height = menu_height.into();
self
}
/// Sets the [`Padding`] of the [`PickList`].
pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
self.padding = padding.into();
@ -725,6 +733,7 @@ where
layout.position() + translation,
*viewport,
bounds.height,
self.menu_height,
))
} else {
None