Add ComboBox widget
- Widget implementation - Widget helper - Example
This commit is contained in:
parent
4cf1b4fd1c
commit
dd5ef8b908
6 changed files with 907 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
//! Helper functions to create pure widgets.
|
||||
use crate::button::{self, Button};
|
||||
use crate::checkbox::{self, Checkbox};
|
||||
use crate::combo_box::{self, ComboBox};
|
||||
use crate::container::{self, Container};
|
||||
use crate::core;
|
||||
use crate::core::widget::operation;
|
||||
|
|
@ -252,6 +253,23 @@ where
|
|||
PickList::new(options, selected, on_selected)
|
||||
}
|
||||
|
||||
/// Creates a new [`ComboBox`].
|
||||
///
|
||||
/// [`ComboBox`]: widget::ComboBox
|
||||
pub fn combo_box<'a, T, Message, Renderer>(
|
||||
state: &'a combo_box::State<T>,
|
||||
placeholder: &str,
|
||||
selection: Option<&T>,
|
||||
on_selected: impl Fn(T) -> Message + 'static,
|
||||
) -> ComboBox<'a, T, Message, Renderer>
|
||||
where
|
||||
T: std::fmt::Display + Clone,
|
||||
Renderer: core::text::Renderer,
|
||||
Renderer::Theme: text_input::StyleSheet + overlay::menu::StyleSheet,
|
||||
{
|
||||
ComboBox::new(state, placeholder, selection, on_selected)
|
||||
}
|
||||
|
||||
/// Creates a new horizontal [`Space`] with the given [`Length`].
|
||||
///
|
||||
/// [`Space`]: widget::Space
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue