fix(appearance): use flex row for accent colors to avoid scrollable overdraw

This commit is contained in:
Michael Aaron Murphy 2025-08-13 21:52:17 +02:00
parent 43be7cb473
commit 9afb4133cc
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -3,7 +3,7 @@ use cosmic::cosmic_theme::Spacing;
use cosmic::cosmic_theme::palette::Srgba; use cosmic::cosmic_theme::palette::Srgba;
use cosmic::iced_core::{Alignment, Length}; use cosmic::iced_core::{Alignment, Length};
use cosmic::widget::icon::{from_name, icon}; use cosmic::widget::icon::{from_name, icon};
use cosmic::widget::{button, container, scrollable, settings, text}; use cosmic::widget::{self, button, container, scrollable, settings, text};
use cosmic::{Apply, Element}; use cosmic::{Apply, Element};
use cosmic_settings_page::Section; use cosmic_settings_page::Section;
use cosmic_settings_wallpaper as wallpaper; use cosmic_settings_wallpaper as wallpaper;
@ -192,23 +192,22 @@ fn accent_color_palette<'a>(
|| page.theme_manager.builder().palette.as_ref().accent_blue, || page.theme_manager.builder().palette.as_ref().accent_blue,
Srgba::from, Srgba::from,
); );
let mut accent_palette_row = cosmic::widget::row::with_capacity(accent.len()); let mut accent_palette_row = Vec::with_capacity(accent.len());
for &color in accent { for &color in accent {
accent_palette_row = accent_palette_row.push(color_button( accent_palette_row.push(
color_button(
Some(Message::PaletteAccent(color.into())), Some(Message::PaletteAccent(color.into())),
color.into(), color.into(),
cur_accent == color, cur_accent == color,
48, 48,
48, 48,
)); )
.into(),
);
} }
cosmic::iced::widget::column![ accent_palette_row.push(
text::body(&descriptions[labels["accent_color"]]),
scrollable::horizontal(
accent_palette_row
.push(
if let Some(c) = page.drawer.custom_accent.get_applied_color() { if let Some(c) = page.drawer.custom_accent.get_applied_color() {
container(color_button( container(color_button(
Some(Message::DrawerOpen(ContextView::CustomAccent)), Some(Message::DrawerOpen(ContextView::CustomAccent)),
@ -221,18 +220,19 @@ fn accent_color_palette<'a>(
container( container(
page.drawer page.drawer
.custom_accent .custom_accent
.picker_button( .picker_button(|_| Message::DrawerOpen(ContextView::CustomAccent), Some(24))
|_| Message::DrawerOpen(ContextView::CustomAccent),
Some(24),
)
.width(Length::Fixed(48.0)) .width(Length::Fixed(48.0))
.height(Length::Fixed(48.0)), .height(Length::Fixed(48.0)),
) )
} }
) .into(),
);
cosmic::iced::widget::column![
text::body(&descriptions[labels["accent_color"]]),
widget::flex_row(accent_palette_row)
.padding([0, 0, 16, 0]) .padding([0, 0, 16, 0])
.spacing(16) .spacing(16)
)
] ]
.padding([16, 0, 0, 0]) .padding([16, 0, 0, 0])
.spacing(space_xxs) .spacing(space_xxs)