libcosmic/src/widget/list/mod.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
2022-10-12 19:44:44 -07:00
pub mod column;
// mod item;
2022-10-12 19:44:44 -07:00
2023-01-03 21:35:35 +01:00
pub use self::column::{list_column, ListColumn};
// pub use self::item::{ListItem, list_item};
use crate::widget::Container;
use crate::Element;
2024-01-30 22:14:00 -05:00
use iced::{Background};
use iced_core::Shadow;
pub fn container<'a, Message>(
content: impl Into<Element<'a, Message>>,
2024-01-30 22:14:00 -05:00
) -> Container<'a, Message, crate::Theme, crate::Renderer> {
super::container(content)
.padding([16, 6])
.style(crate::theme::Container::custom(style))
.width(iced::Length::Fill)
}
#[must_use]
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn style(theme: &crate::Theme) -> crate::widget::container::Appearance {
let container = &theme.current_container().component;
crate::widget::container::Appearance {
icon_color: Some(container.on.into()),
text_color: Some(container.on.into()),
background: Some(Background::Color(container.base.into())),
2024-01-30 22:14:00 -05:00
border: iced::Border {
radius: theme.cosmic().corner_radii.radius_s.into(),
..Default::default()
},
shadow: Shadow::default(),
}
}