Skip to content

Commit 8981501

Browse files
git-f0xmmstick
authored andcommitted
fix(appearance): roundness button style
1 parent 85dcfc6 commit 8981501

File tree

6 files changed

+74
-50
lines changed

6 files changed

+74
-50
lines changed

cosmic-settings/src/pages/desktop/appearance/mod.rs

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
16031603
cosmic::iced::widget::column![
16041604
button::custom(
16051605
icon(dark_mode_illustration.clone())
1606-
.width(Length::Fill)
1606+
.width(Length::Fixed(191.0))
16071607
.height(Length::Fixed(100.0))
16081608
)
16091609
.class(button::ButtonClass::Image)
@@ -1612,13 +1612,13 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
16121612
.on_press(Message::DarkMode(true)),
16131613
text::body(&descriptions[dark])
16141614
]
1615-
.spacing(space_xxs)
1615+
.spacing(8)
16161616
.width(Length::FillPortion(1))
16171617
.align_x(Alignment::Center),
16181618
cosmic::iced::widget::column![
16191619
button::custom(
16201620
icon(light_mode_illustration.clone(),)
1621-
.width(Length::Fill)
1621+
.width(Length::Fixed(191.0))
16221622
.height(Length::Fixed(100.0))
16231623
)
16241624
.class(button::ButtonClass::Image)
@@ -1627,13 +1627,13 @@ pub fn mode_and_colors() -> Section<crate::pages::Message> {
16271627
.on_press(Message::DarkMode(false)),
16281628
text::body(&descriptions[light])
16291629
]
1630-
.spacing(space_xxs)
1630+
.spacing(8)
16311631
.width(Length::FillPortion(1))
16321632
.align_x(Alignment::Center)
16331633
]
1634-
.spacing(48)
1635-
.align_y(Alignment::Center)
1636-
.width(Length::Fixed(424.0)),
1634+
.spacing(8)
1635+
.width(Length::Fixed(478.0))
1636+
.align_y(Alignment::Center),
16371637
)
16381638
.center_x(Length::Fill),
16391639
)
@@ -1836,6 +1836,21 @@ pub fn style() -> Section<crate::pages::Message> {
18361836
let dark_square_style = from_name("illustration-appearance-dark-style-square").handle();
18371837
let light_square_style = from_name("illustration-appearance-light-style-square").handle();
18381838

1839+
fn style_container() -> cosmic::theme::Container<'static> {
1840+
cosmic::theme::Container::custom(|theme| {
1841+
let mut background = theme.cosmic().palette.neutral_9;
1842+
background.alpha = 0.1;
1843+
container::Style {
1844+
background: Some(cosmic::iced::Background::Color(background.into())),
1845+
border: cosmic::iced::Border {
1846+
radius: theme.cosmic().radius_s().into(),
1847+
..Default::default()
1848+
},
1849+
..Default::default()
1850+
}
1851+
})
1852+
}
1853+
18391854
Section::default()
18401855
.title(fl!("style"))
18411856
.descriptions(descriptions)
@@ -1862,8 +1877,11 @@ pub fn style() -> Section<crate::pages::Message> {
18621877
)
18631878
.selected(matches!(page.roundness, Roundness::Round))
18641879
.class(button::ButtonClass::Image)
1865-
.padding(8)
1866-
.on_press(Message::Roundness(Roundness::Round)),
1880+
.padding(0)
1881+
.on_press(Message::Roundness(Roundness::Round))
1882+
.apply(container)
1883+
.width(Length::Fixed(191.0))
1884+
.class(style_container()),
18671885
text::body(&descriptions[round])
18681886
]
18691887
.spacing(8)
@@ -1884,8 +1902,11 @@ pub fn style() -> Section<crate::pages::Message> {
18841902
)
18851903
.selected(matches!(page.roundness, Roundness::SlightlyRound))
18861904
.class(button::ButtonClass::Image)
1887-
.padding(8)
1888-
.on_press(Message::Roundness(Roundness::SlightlyRound)),
1905+
.padding(0)
1906+
.on_press(Message::Roundness(Roundness::SlightlyRound))
1907+
.apply(container)
1908+
.width(Length::Fixed(191.0))
1909+
.class(style_container()),
18891910
text::body(&descriptions[slightly_round])
18901911
]
18911912
.spacing(8)
@@ -1907,16 +1928,18 @@ pub fn style() -> Section<crate::pages::Message> {
19071928
.width(Length::FillPortion(1))
19081929
.selected(matches!(page.roundness, Roundness::Square))
19091930
.class(button::ButtonClass::Image)
1910-
.padding(8)
1911-
.on_press(Message::Roundness(Roundness::Square)),
1931+
.padding(0)
1932+
.on_press(Message::Roundness(Roundness::Square))
1933+
.apply(container)
1934+
.width(Length::Fixed(191.0))
1935+
.class(style_container()),
19121936
text::body(&descriptions[square])
19131937
]
19141938
.spacing(8)
19151939
.align_x(Alignment::Center)
19161940
.width(Length::FillPortion(1))
19171941
]
1918-
.spacing(12)
1919-
.width(Length::Fixed(628.0))
1942+
.spacing(8)
19201943
.align_y(Alignment::Center),
19211944
)
19221945
.center_x(Length::Fill),

cosmic-settings/src/pages/display/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,6 @@ pub fn display_arrangement() -> Section<crate::pages::Message> {
10951095
.width(Length::Shrink)
10961096
.direction(Direction::Horizontal(Scrollbar::new()))
10971097
.apply(container)
1098-
.padding([48, 32, 32, 32])
10991098
.center_x(Length::Fill)
11001099
})
11011100
.apply(container)

cosmic-settings/src/pages/system/users/mod.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ mod getent;
66
use cosmic::{
77
dialog::file_chooser,
88
iced::{Alignment, Length},
9-
theme,
109
widget::{self, column, icon, settings, text},
1110
Apply, Element,
1211
};
@@ -216,7 +215,7 @@ impl page::Page<crate::pages::Message> for Page {
216215
)
217216
.primary_action(add_user_button)
218217
.secondary_action(cancel_button)
219-
.apply(cosmic::Element::from)
218+
.apply(Element::from)
220219
}
221220
};
222221

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

590-
let theme = cosmic::theme::active();
591-
let theme = theme.cosmic();
592-
593589
let cosmic::cosmic_theme::Spacing {
594590
space_xxs, space_m, ..
595-
} = theme::active().cosmic().spacing;
591+
} = cosmic::theme::active().cosmic().spacing;
596592

597593
let users_list = page
598594
.users
@@ -661,7 +657,7 @@ fn user_list() -> Section<crate::pages::Message> {
661657
]));
662658
}
663659

664-
details_list.apply(cosmic::Element::from)
660+
details_list.apply(Element::from)
665661
});
666662

667663
let profile_icon_handle = user
@@ -682,7 +678,7 @@ fn user_list() -> Section<crate::pages::Message> {
682678
.push(account_type),
683679
)
684680
.align_y(Alignment::Center)
685-
.spacing(theme.space_xxs())
681+
.spacing(space_xxs)
686682
.into(),
687683
widget::horizontal_space().width(Length::Fill).into(),
688684
icon::from_name(if expanded {
@@ -701,7 +697,7 @@ fn user_list() -> Section<crate::pages::Message> {
701697
.on_press(Message::SelectUser(idx))
702698
.class(cosmic::theme::Button::ListItem)
703699
.selected(expanded)
704-
.apply(cosmic::Element::from),
700+
.apply(Element::from),
705701
);
706702

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

720716
let add_user = widget::button::standard(crate::fl!("add-user"))
721717
.on_press(Message::Dialog(Some(Dialog::AddNewUser(User::default()))))
Lines changed: 10 additions & 8 deletions
Loading
Lines changed: 10 additions & 8 deletions
Loading
Lines changed: 10 additions & 8 deletions
Loading

0 commit comments

Comments
 (0)