2022-09-30 09:35:55 -06:00
|
|
|
use iced::{
|
|
|
|
|
Background,
|
|
|
|
|
Color,
|
|
|
|
|
Theme,
|
2022-09-30 09:57:11 -06:00
|
|
|
widget,
|
2022-09-30 09:35:55 -06:00
|
|
|
};
|
|
|
|
|
|
2022-09-30 09:57:11 -06:00
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! list_view {
|
|
|
|
|
($($x:expr),+ $(,)?) => (
|
|
|
|
|
$crate::iced::widget::Container::new(
|
|
|
|
|
$crate::iced::widget::Column::with_children(
|
|
|
|
|
vec![$($crate::iced::Element::from($x)),+]
|
|
|
|
|
)
|
|
|
|
|
.spacing(12)
|
|
|
|
|
)
|
|
|
|
|
.padding([12, 16])
|
|
|
|
|
.style(theme::Container::Custom(
|
|
|
|
|
$crate::widget::list_view_style
|
|
|
|
|
))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
pub use list_view;
|
|
|
|
|
|
|
|
|
|
pub fn list_view_style(theme: &Theme) -> widget::container::Appearance {
|
|
|
|
|
widget::container::Appearance {
|
2022-09-30 09:35:55 -06:00
|
|
|
text_color: None,
|
|
|
|
|
background: Some(Background::Color(
|
|
|
|
|
match theme {
|
|
|
|
|
Theme::Dark => Color::from_rgb8(0x27, 0x27, 0x27),
|
|
|
|
|
Theme::Light => Color::from_rgb8(0xf7, 0xf7, 0xf7),
|
|
|
|
|
}
|
|
|
|
|
)),
|
|
|
|
|
border_radius: 8.0,
|
|
|
|
|
border_width: 0.0,
|
|
|
|
|
border_color: Color::TRANSPARENT,
|
|
|
|
|
}
|
|
|
|
|
}
|