refactor(theme): create Container::List style variant
This commit is contained in:
parent
db5d989972
commit
85898347e2
2 changed files with 17 additions and 19 deletions
|
|
@ -374,6 +374,7 @@ pub enum Container {
|
|||
Dialog,
|
||||
Dropdown,
|
||||
HeaderBar,
|
||||
List,
|
||||
Primary,
|
||||
Secondary,
|
||||
Tooltip,
|
||||
|
|
@ -457,6 +458,21 @@ impl container::StyleSheet for Theme {
|
|||
shadow: Shadow::default(),
|
||||
},
|
||||
|
||||
Container::List => {
|
||||
let component = &self.current_container().component;
|
||||
|
||||
container::Appearance {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
background: Some(Background::Color(component.base.into())),
|
||||
border: iced::Border {
|
||||
radius: cosmic.corner_radii.radius_s.into(),
|
||||
..Default::default()
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
}
|
||||
}
|
||||
|
||||
Container::HeaderBar => container::Appearance {
|
||||
icon_color: Some(Color::from(cosmic.accent.base)),
|
||||
text_color: Some(Color::from(cosmic.background.on)),
|
||||
|
|
|
|||
|
|
@ -9,30 +9,12 @@ pub use self::column::{list_column, ListColumn};
|
|||
|
||||
use crate::widget::Container;
|
||||
use crate::Element;
|
||||
use iced::Background;
|
||||
use iced_core::Shadow;
|
||||
|
||||
pub fn container<'a, Message>(
|
||||
content: impl Into<Element<'a, Message>>,
|
||||
) -> Container<'a, Message, crate::Theme, crate::Renderer> {
|
||||
super::container(content)
|
||||
.padding([16, 6])
|
||||
.style(crate::theme::Container::custom(style))
|
||||
.style(crate::theme::Container::List)
|
||||
.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())),
|
||||
border: iced::Border {
|
||||
radius: theme.cosmic().corner_radii.radius_s.into(),
|
||||
..Default::default()
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue