Skip to content

Commit

Permalink
fix: prevent checkmark clipping in font and region selection drawers
Browse files Browse the repository at this point in the history
  • Loading branch information
git-f0x authored Feb 20, 2025
1 parent 8e7ed01 commit d853267
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
7 changes: 3 additions & 4 deletions cosmic-settings/src/pages/desktop/appearance/font_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ pub fn selection_context<'a>(
) -> Element<'a, super::Message> {
let space_l = theme::active().cosmic().spacing.space_l;

let svg_accent = Rc::new(|theme: &cosmic::Theme| {
let color = theme.cosmic().accent_color().into();
svg::Style { color: Some(color) }
let svg_accent = Rc::new(|theme: &cosmic::Theme| svg::Style {
color: Some(theme.cosmic().accent_color().into()),
});

let search_input = widget::search_input(fl!("type-to-search"), search)
Expand All @@ -86,8 +85,8 @@ pub fn selection_context<'a>(
settings::item_row(vec![
widget::text::body(&**family)
.wrapping(Wrapping::Word)
.width(cosmic::iced::Length::Fill)
.into(),
widget::horizontal_space().into(),
if selected {
widget::icon::from_name("object-select-symbolic")
.size(16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn button(
)
.on_press(Message::IconTheme(id))
.selected(selected)
.padding([theme.space_xs(), theme.space_xs() + 1])
.padding(theme.space_xs())
// Image button's style mostly works, but it needs a background to fit the design
.class(button::ButtonClass::Custom {
active: Box::new(move |focused, theme| {
Expand Down
2 changes: 2 additions & 0 deletions cosmic-settings/src/pages/desktop/appearance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ impl Page {
)
.row_spacing(theme.space_xs())
.column_spacing(theme.space_xs())
.apply(container)
.center_x(Length::Fill)
.into()
])
.spacing(theme.space_xxs())
Expand Down
3 changes: 2 additions & 1 deletion cosmic-settings/src/pages/time/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ impl Page {
cosmic::theme::Text::Default
})
.wrapping(Wrapping::Word)
.width(Length::Fill)
.into(),
widget::horizontal_space().into(),
if is_installed {
widget::icon::from_name("object-select-symbolic")
.size(16)
Expand Down Expand Up @@ -549,6 +549,7 @@ impl Page {
cosmic::theme::Text::Default
})
.wrapping(Wrapping::Word)
.width(Length::Fill)
.into(),
if is_selected {
widget::icon::from_name("object-select-symbolic")
Expand Down
18 changes: 6 additions & 12 deletions cosmic-settings/src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn color_picker_context_view<'a, Message: Clone + 'static>(
let theme = theme::active();
let spacing = &theme.cosmic().spacing;

let description = description.map(|description| text(description).width(Length::Fill));
let description = description.map(|description| text::caption(description));

let color_picker = model
.builder(on_update)
Expand All @@ -35,15 +35,13 @@ pub fn color_picker_context_view<'a, Message: Clone + 'static>(
fl!("copied-to-clipboard"),
)
.apply(container)
.width(Length::Fixed(248.0))
.align_x(Alignment::Center)
.center_x(Length::Fixed(248.0))
.apply(container)
.center_x(Length::Fill);

cosmic::widget::column()
.push_maybe(description)
.push(color_picker)
.padding(spacing.space_l)
.align_x(Alignment::Center)
.spacing(spacing.space_m)
.width(Length::Fill)
Expand Down Expand Up @@ -103,17 +101,13 @@ pub fn unimplemented_page<Message: 'static>() -> Element<'static, Message> {

#[must_use]
pub fn display_container<'a, Message: 'a>(widget: Element<'a, Message>) -> Element<'a, Message> {
let display = container(widget)
container(widget)
.class(crate::theme::display_container_screen())
.apply(container)
.padding(4)
.class(crate::theme::display_container_frame());

row::with_capacity(3)
.push(horizontal_space())
.push(display)
.push(horizontal_space())
.padding([0, 0, 8, 0])
.class(crate::theme::display_container_frame())
.apply(container)
.center_x(Length::Fill)
.into()
}

Expand Down

0 comments on commit d853267

Please sign in to comment.