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

View file

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