Wire up style to PickList and overlay::Menu

This commit is contained in:
Héctor Ramón Jiménez 2021-10-28 15:41:12 +07:00
parent 687c35e052
commit fe4dfeafdb
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
4 changed files with 30 additions and 87 deletions

View file

@ -1,26 +1,9 @@
//! Display a dropdown list of selectable values.
use crate::backend::{self, Backend};
use crate::Renderer;
use iced_native::Padding;
use iced_style::menu;
pub use iced_native::pick_list::State;
pub use iced_style::pick_list::{Style, StyleSheet};
/// A widget allowing the selection of a single value from a list of options.
pub type PickList<'a, T, Message, Backend> =
iced_native::PickList<'a, T, Message, Renderer<Backend>>;
impl<B> iced_native::pick_list::Renderer for Renderer<B>
where
B: Backend + backend::Text,
{
type Style = Box<dyn StyleSheet>;
const DEFAULT_PADDING: Padding = Padding::new(5);
fn menu_style(style: &Box<dyn StyleSheet>) -> menu::Style {
style.menu()
}
}