Skip to content

Commit

Permalink
fix(appearance): roundness button style
Browse files Browse the repository at this point in the history
  • Loading branch information
git-f0x authored and mmstick committed Dec 17, 2024
1 parent 85dcfc6 commit 8981501
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 50 deletions.
53 changes: 38 additions & 15 deletions cosmic-settings/src/pages/desktop/appearance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
cosmic::iced::widget::column![
button::custom(
icon(dark_mode_illustration.clone())
.width(Length::Fill)
.width(Length::Fixed(191.0))
.height(Length::Fixed(100.0))
)
.class(button::ButtonClass::Image)
Expand All @@ -1612,13 +1612,13 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
.on_press(Message::DarkMode(true)),
text::body(&descriptions[dark])
]
.spacing(space_xxs)
.spacing(8)
.width(Length::FillPortion(1))
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
icon(light_mode_illustration.clone(),)
.width(Length::Fill)
.width(Length::Fixed(191.0))
.height(Length::Fixed(100.0))
)
.class(button::ButtonClass::Image)
Expand All @@ -1627,13 +1627,13 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
.on_press(Message::DarkMode(false)),
text::body(&descriptions[light])
]
.spacing(space_xxs)
.spacing(8)
.width(Length::FillPortion(1))
.align_x(Alignment::Center)
]
.spacing(48)
.align_y(Alignment::Center)
.width(Length::Fixed(424.0)),
.spacing(8)
.width(Length::Fixed(478.0))
.align_y(Alignment::Center),
)
.center_x(Length::Fill),
)
Expand Down Expand Up @@ -1836,6 +1836,21 @@ pub fn style() -> Section<crate::pages::Message> {
let dark_square_style = from_name("illustration-appearance-dark-style-square").handle();
let light_square_style = from_name("illustration-appearance-light-style-square").handle();

fn style_container() -> cosmic::theme::Container<'static> {
cosmic::theme::Container::custom(|theme| {
let mut background = theme.cosmic().palette.neutral_9;
background.alpha = 0.1;
container::Style {
background: Some(cosmic::iced::Background::Color(background.into())),
border: cosmic::iced::Border {
radius: theme.cosmic().radius_s().into(),
..Default::default()
},
..Default::default()
}
})
}

Section::default()
.title(fl!("style"))
.descriptions(descriptions)
Expand All @@ -1862,8 +1877,11 @@ pub fn style() -> Section<crate::pages::Message> {
)
.selected(matches!(page.roundness, Roundness::Round))
.class(button::ButtonClass::Image)
.padding(8)
.on_press(Message::Roundness(Roundness::Round)),
.padding(0)
.on_press(Message::Roundness(Roundness::Round))
.apply(container)
.width(Length::Fixed(191.0))
.class(style_container()),
text::body(&descriptions[round])
]
.spacing(8)
Expand All @@ -1884,8 +1902,11 @@ pub fn style() -> Section<crate::pages::Message> {
)
.selected(matches!(page.roundness, Roundness::SlightlyRound))
.class(button::ButtonClass::Image)
.padding(8)
.on_press(Message::Roundness(Roundness::SlightlyRound)),
.padding(0)
.on_press(Message::Roundness(Roundness::SlightlyRound))
.apply(container)
.width(Length::Fixed(191.0))
.class(style_container()),
text::body(&descriptions[slightly_round])
]
.spacing(8)
Expand All @@ -1907,16 +1928,18 @@ pub fn style() -> Section<crate::pages::Message> {
.width(Length::FillPortion(1))
.selected(matches!(page.roundness, Roundness::Square))
.class(button::ButtonClass::Image)
.padding(8)
.on_press(Message::Roundness(Roundness::Square)),
.padding(0)
.on_press(Message::Roundness(Roundness::Square))
.apply(container)
.width(Length::Fixed(191.0))
.class(style_container()),
text::body(&descriptions[square])
]
.spacing(8)
.align_x(Alignment::Center)
.width(Length::FillPortion(1))
]
.spacing(12)
.width(Length::Fixed(628.0))
.spacing(8)
.align_y(Alignment::Center),
)
.center_x(Length::Fill),
Expand Down
1 change: 0 additions & 1 deletion cosmic-settings/src/pages/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,6 @@ pub fn display_arrangement() -> Section<crate::pages::Message> {
.width(Length::Shrink)
.direction(Direction::Horizontal(Scrollbar::new()))
.apply(container)
.padding([48, 32, 32, 32])
.center_x(Length::Fill)
})
.apply(container)
Expand Down
16 changes: 6 additions & 10 deletions cosmic-settings/src/pages/system/users/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod getent;
use cosmic::{
dialog::file_chooser,
iced::{Alignment, Length},
theme,
widget::{self, column, icon, settings, text},
Apply, Element,
};
Expand Down Expand Up @@ -216,7 +215,7 @@ impl page::Page<crate::pages::Message> for Page {
)
.primary_action(add_user_button)
.secondary_action(cancel_button)
.apply(cosmic::Element::from)
.apply(Element::from)
}
};

Expand Down Expand Up @@ -587,12 +586,9 @@ fn user_list() -> Section<crate::pages::Message> {
.view::<Page>(move |_binder, page, section| {
let descriptions = &section.descriptions;

let theme = cosmic::theme::active();
let theme = theme.cosmic();

let cosmic::cosmic_theme::Spacing {
space_xxs, space_m, ..
} = theme::active().cosmic().spacing;
} = cosmic::theme::active().cosmic().spacing;

let users_list = page
.users
Expand Down Expand Up @@ -661,7 +657,7 @@ fn user_list() -> Section<crate::pages::Message> {
]));
}

details_list.apply(cosmic::Element::from)
details_list.apply(Element::from)
});

let profile_icon_handle = user
Expand All @@ -682,7 +678,7 @@ fn user_list() -> Section<crate::pages::Message> {
.push(account_type),
)
.align_y(Alignment::Center)
.spacing(theme.space_xxs())
.spacing(space_xxs)
.into(),
widget::horizontal_space().width(Length::Fill).into(),
icon::from_name(if expanded {
Expand All @@ -701,7 +697,7 @@ fn user_list() -> Section<crate::pages::Message> {
.on_press(Message::SelectUser(idx))
.class(cosmic::theme::Button::ListItem)
.selected(expanded)
.apply(cosmic::Element::from),
.apply(Element::from),
);

vec![account_details, expanded_details]
Expand All @@ -715,7 +711,7 @@ fn user_list() -> Section<crate::pages::Message> {
.list_item_padding(0),
widget::ListColumn::add,
)
.apply(|list| cosmic::Element::from(settings::section::with_column(list)));
.apply(|list| Element::from(settings::section::with_column(list)));

let add_user = widget::button::standard(crate::fl!("add-user"))
.on_press(Message::Dialog(Some(Dialog::AddNewUser(User::default()))))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8981501

Please sign in to comment.