fix(appearance): use image buttons to get selection icons

This commit is contained in:
Michael Aaron Murphy 2025-08-13 21:22:39 +02:00
parent 927dd3a512
commit 874b674a44
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
2 changed files with 23 additions and 15 deletions

View file

@ -250,10 +250,11 @@ fn theme_mode<'a>(
container(
cosmic::iced::widget::row![
cosmic::iced::widget::column![
button::custom(
button::custom_image_button(
icon(dark_mode_illustration)
.width(Length::Fixed(191.0))
.height(Length::Fixed(100.0))
.height(Length::Fixed(100.0)),
None
)
.class(button::ButtonClass::Image)
.padding([8, 0])
@ -265,10 +266,11 @@ fn theme_mode<'a>(
.width(Length::FillPortion(1))
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
button::custom_image_button(
icon(light_mode_illustration,)
.width(Length::Fixed(191.0))
.height(Length::Fixed(100.0))
.height(Length::Fixed(100.0)),
None
)
.class(button::ButtonClass::Image)
.selected(!page.theme_manager.mode().is_dark)
@ -295,12 +297,15 @@ pub fn color_button<'a, Message: 'a + Clone>(
width: u16,
height: u16,
) -> Element<'a, Message> {
button::custom(color_image(
wallpaper::Color::Single([color.r, color.g, color.b]),
width,
height,
button::custom_image_button(
color_image(
wallpaper::Color::Single([color.r, color.g, color.b]),
width,
height,
None,
),
None,
))
)
.padding(0)
.selected(selected)
.class(button::ButtonClass::Image)

View file

@ -53,7 +53,7 @@ pub fn section() -> Section<crate::pages::Message> {
container(
cosmic::iced::widget::row![
cosmic::iced::widget::column![
button::custom(
button::custom_image_button(
icon(
if page.theme_manager.mode().is_dark {
&dark_round_style
@ -63,7 +63,8 @@ pub fn section() -> Section<crate::pages::Message> {
.clone()
)
.width(Length::Fill)
.height(Length::Fixed(100.0))
.height(Length::Fixed(100.0)),
None
)
.selected(matches!(page.roundness, Roundness::Round))
.class(button::ButtonClass::Image)
@ -78,7 +79,7 @@ pub fn section() -> Section<crate::pages::Message> {
.width(Length::FillPortion(1))
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
button::custom_image_button(
icon(
if page.theme_manager.mode().is_dark {
&dark_slightly_round_style
@ -88,7 +89,8 @@ pub fn section() -> Section<crate::pages::Message> {
.clone()
)
.width(Length::Fill)
.height(Length::Fixed(100.0))
.height(Length::Fixed(100.0)),
None
)
.selected(matches!(page.roundness, Roundness::SlightlyRound))
.class(button::ButtonClass::Image)
@ -103,7 +105,7 @@ pub fn section() -> Section<crate::pages::Message> {
.width(Length::FillPortion(1))
.align_x(Alignment::Center),
cosmic::iced::widget::column![
button::custom(
button::custom_image_button(
icon(
if page.theme_manager.mode().is_dark {
&dark_square_style
@ -113,7 +115,8 @@ pub fn section() -> Section<crate::pages::Message> {
.clone()
)
.width(Length::Fill)
.height(Length::Fixed(100.0))
.height(Length::Fixed(100.0)),
None
)
.width(Length::FillPortion(1))
.selected(matches!(page.roundness, Roundness::Square))