refactor: use theme corner_radii
This commit is contained in:
parent
feb8075d2c
commit
3de4b99e66
6 changed files with 99 additions and 86 deletions
|
|
@ -1434,7 +1434,7 @@ pub fn color_button<'a, Message: 'a + Clone>(
|
|||
wallpaper::Color::Single([color.r, color.g, color.b]),
|
||||
width,
|
||||
height,
|
||||
8.0,
|
||||
None,
|
||||
))
|
||||
.padding(0)
|
||||
.selected(selected)
|
||||
|
|
|
|||
|
|
@ -928,7 +928,12 @@ pub fn settings() -> Section<crate::pages::Message> {
|
|||
// Displays color options, and hides the slideshow toggle
|
||||
Choice::Color(ref color) => {
|
||||
show_slideshow_toggle = false;
|
||||
widgets::color_image(color.clone(), SIMULATED_WIDTH, SIMULATED_HEIGHT, 0.0)
|
||||
widgets::color_image(
|
||||
color.clone(),
|
||||
SIMULATED_WIDTH,
|
||||
SIMULATED_HEIGHT,
|
||||
Some(0.0),
|
||||
)
|
||||
}
|
||||
},
|
||||
));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub fn color_button(
|
|||
removable: bool,
|
||||
selected: bool,
|
||||
) -> Element<'static, Message> {
|
||||
let content = color_image(color.clone(), COLOR_WIDTH, COLOR_WIDTH, 8.0);
|
||||
let content = color_image(color.clone(), COLOR_WIDTH, COLOR_WIDTH, None);
|
||||
let on_remove = if removable {
|
||||
Some(Message::ColorRemove(color.clone()))
|
||||
} else {
|
||||
|
|
@ -40,10 +40,10 @@ pub fn color_image<'a, M: 'a>(
|
|||
color: wallpaper::Color,
|
||||
width: u16,
|
||||
height: u16,
|
||||
border_radius: f32,
|
||||
border_radius: Option<f32>,
|
||||
) -> Element<'a, M> {
|
||||
container(space::Space::new(width, height))
|
||||
.style(cosmic::theme::Container::custom(move |_theme| {
|
||||
.style(cosmic::theme::Container::custom(move |theme| {
|
||||
container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
|
|
@ -66,7 +66,9 @@ pub fn color_image<'a, M: 'a>(
|
|||
Background::Gradient(iced_core::Gradient::Linear(linear))
|
||||
}
|
||||
}),
|
||||
border_radius: BorderRadius::from(border_radius),
|
||||
border_radius: border_radius
|
||||
.map(|br| br.into())
|
||||
.unwrap_or_else(|| theme.cosmic().corner_radii.radius_s.into()),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,11 +93,12 @@ fn popover_menu() -> cosmic::Element<'static, Message> {
|
|||
.height(Length::Shrink)
|
||||
.apply(cosmic::widget::container)
|
||||
.style(cosmic::theme::Container::custom(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
container::Appearance {
|
||||
icon_color: Some(theme.cosmic().background.on.into()),
|
||||
text_color: Some(theme.cosmic().background.on.into()),
|
||||
background: Some(iced::Color::from(theme.cosmic().background.base).into()),
|
||||
border_radius: (12.0).into(),
|
||||
border_radius: cosmic.corner_radii.radius_m.into(),
|
||||
border_width: 0.0,
|
||||
border_color: iced::Color::TRANSPARENT,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,24 +5,30 @@ use cosmic::{iced_widget::core::BorderRadius, theme};
|
|||
|
||||
#[must_use]
|
||||
pub fn display_container_frame() -> cosmic::theme::Container {
|
||||
theme::Container::custom(|_theme| cosmic::widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::WHITE)),
|
||||
border_color: cosmic::iced::Color::WHITE,
|
||||
border_radius: BorderRadius::from(4.0),
|
||||
border_width: 3.0,
|
||||
theme::Container::custom(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
cosmic::widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::WHITE)),
|
||||
border_color: cosmic::iced::Color::WHITE,
|
||||
border_radius: cosmic.corner_radii.radius_xs.into(),
|
||||
border_width: 3.0,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn display_container_screen() -> cosmic::theme::Container {
|
||||
theme::Container::custom(|_theme| cosmic::widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::BLACK)),
|
||||
border_color: cosmic::iced::Color::BLACK,
|
||||
border_radius: BorderRadius::from(0.0),
|
||||
border_width: 0.0,
|
||||
theme::Container::custom(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
cosmic::widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::BLACK)),
|
||||
border_color: cosmic::iced::Color::BLACK,
|
||||
border_radius: cosmic.corner_radii.radius_0.into(),
|
||||
border_width: 0.0,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue