Add text_shaping method to combo_box widget

This commit is contained in:
MYT 2025-01-01 13:03:38 +00:00 committed by Héctor Ramón Jiménez
parent bbf936237d
commit d5e02408bb
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 17 additions and 4 deletions

View file

@ -149,9 +149,10 @@ pub struct ComboBox<
on_open: Option<Message>,
on_close: Option<Message>,
on_input: Option<Box<dyn Fn(String) -> Message>>,
menu_class: <Theme as menu::Catalog>::Class<'a>,
padding: Padding,
size: Option<f32>,
text_shaping: text::Shaping,
menu_class: <Theme as menu::Catalog>::Class<'a>,
menu_height: Length,
}
@ -186,9 +187,10 @@ where
on_input: None,
on_open: None,
on_close: None,
menu_class: <Theme as Catalog>::default_menu(),
padding: text_input::DEFAULT_PADDING,
size: None,
text_shaping: text::Shaping::default(),
menu_class: <Theme as Catalog>::default_menu(),
menu_height: Length::Shrink,
}
}
@ -281,6 +283,12 @@ where
self
}
/// Sets the [`text::Shaping`] strategy of the [`ComboBox`].
pub fn text_shaping(mut self, shaping: text::Shaping) -> Self {
self.text_shaping = shaping;
self
}
/// Sets the style of the input of the [`ComboBox`].
#[must_use]
pub fn input_style(
@ -902,7 +910,8 @@ where
&self.menu_class,
)
.width(bounds.width)
.padding(self.padding);
.padding(self.padding)
.text_shaping(self.text_shaping);
if let Some(font) = self.font {
menu = menu.font(font);