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,47 +192,47 @@ 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(
Some(Message::PaletteAccent(color.into())), color_button(
color.into(), Some(Message::PaletteAccent(color.into())),
cur_accent == color, color.into(),
48, cur_accent == color,
48, 48,
)); 48,
)
.into(),
);
} }
accent_palette_row.push(
if let Some(c) = page.drawer.custom_accent.get_applied_color() {
container(color_button(
Some(Message::DrawerOpen(ContextView::CustomAccent)),
c,
cosmic::iced::Color::from(cur_accent) == c,
48,
48,
))
} else {
container(
page.drawer
.custom_accent
.picker_button(|_| Message::DrawerOpen(ContextView::CustomAccent), Some(24))
.width(Length::Fixed(48.0))
.height(Length::Fixed(48.0)),
)
}
.into(),
);
cosmic::iced::widget::column![ cosmic::iced::widget::column![
text::body(&descriptions[labels["accent_color"]]), text::body(&descriptions[labels["accent_color"]]),
scrollable::horizontal( widget::flex_row(accent_palette_row)
accent_palette_row .padding([0, 0, 16, 0])
.push( .spacing(16)
if let Some(c) = page.drawer.custom_accent.get_applied_color() {
container(color_button(
Some(Message::DrawerOpen(ContextView::CustomAccent)),
c,
cosmic::iced::Color::from(cur_accent) == c,
48,
48,
))
} else {
container(
page.drawer
.custom_accent
.picker_button(
|_| Message::DrawerOpen(ContextView::CustomAccent),
Some(24),
)
.width(Length::Fixed(48.0))
.height(Length::Fixed(48.0)),
)
}
)
.padding([0, 0, 16, 0])
.spacing(16)
)
] ]
.padding([16, 0, 0, 0]) .padding([16, 0, 0, 0])
.spacing(space_xxs) .spacing(space_xxs)