diff options
author | 2024-03-06 20:30:58 +0100 | |
---|---|---|
committer | 2024-03-06 20:30:58 +0100 | |
commit | 34e7c6593a9e0f56cee5db18b7258717cf6bc11b (patch) | |
tree | 7c65a58e9052f2f95a0025355679b13c7002eeab /widget/src/combo_box.rs | |
parent | 8a63774b24488f71147a728123551ae72c080d14 (diff) | |
download | iced-34e7c6593a9e0f56cee5db18b7258717cf6bc11b.tar.gz iced-34e7c6593a9e0f56cee5db18b7258717cf6bc11b.tar.bz2 iced-34e7c6593a9e0f56cee5db18b7258717cf6bc11b.zip |
Use `Style` struct pattern instead of trait for all widgets
Diffstat (limited to 'widget/src/combo_box.rs')
-rw-r--r-- | widget/src/combo_box.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/widget/src/combo_box.rs b/widget/src/combo_box.rs index 533daab2..1140f1c6 100644 --- a/widget/src/combo_box.rs +++ b/widget/src/combo_box.rs @@ -1,5 +1,4 @@ //! Display a dropdown list of searchable and selectable options. -use crate::container; use crate::core::event::{self, Event}; use crate::core::keyboard; use crate::core::keyboard::key; @@ -14,7 +13,6 @@ use crate::core::{ Clipboard, Element, Length, Padding, Rectangle, Shell, Size, Vector, }; use crate::overlay::menu; -use crate::scrollable; use crate::style::Theme; use crate::text::LineHeight; use crate::text_input::{self, TextInput}; @@ -65,14 +63,16 @@ where on_selected: impl Fn(T) -> Message + 'static, ) -> Self where - Theme: text_input::Style, Style<Theme>: Default, { let style = Style::<Theme>::default(); - let text_input = TextInput::new(placeholder, &state.value()) - .on_input(TextInputEvent::TextChanged) - .style(style.text_input); + let text_input = TextInput::with_style( + placeholder, + &state.value(), + style.text_input, + ) + .on_input(TextInputEvent::TextChanged); let selection = selection.map(T::to_string).unwrap_or_default(); @@ -294,7 +294,6 @@ impl<'a, T, Message, Theme, Renderer> Widget<Message, Theme, Renderer> where T: Display + Clone + 'static, Message: Clone, - Theme: scrollable::Style + container::Style, Renderer: text::Renderer, { fn size(&self) -> Size<Length> { @@ -711,7 +710,7 @@ impl<'a, T, Message, Theme, Renderer> where T: Display + Clone + 'static, Message: Clone + 'a, - Theme: scrollable::Style + container::Style + 'a, + Theme: 'a, Renderer: text::Renderer + 'a, { fn from(combo_box: ComboBox<'a, T, Message, Theme, Renderer>) -> Self { |