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

@ -152,6 +152,7 @@ pub struct ComboBox<
menu_class: <Theme as menu::Catalog>::Class<'a>,
padding: Padding,
size: Option<f32>,
menu_height: Length,
}
impl<'a, T, Message, Theme, Renderer> ComboBox<'a, T, Message, Theme, Renderer>
@ -188,6 +189,7 @@ where
menu_class: <Theme as Catalog>::default_menu(),
padding: text_input::DEFAULT_PADDING,
size: None,
menu_height: Length::Shrink,
}
}
@ -273,6 +275,12 @@ where
}
}
/// Sets the height of the menu of the [`ComboBox`].
pub fn menu_height(mut self, menu_height: impl Into<Length>) -> Self {
self.menu_height = menu_height.into();
self
}
/// Sets the style of the input of the [`ComboBox`].
#[must_use]
pub fn input_style(
@ -908,6 +916,7 @@ where
layout.position() + translation,
*viewport,
bounds.height,
self.menu_height,
))
}
} else {