fix: text disappearing when moving sliders

This commit is contained in:
19MisterX98 2025-05-12 16:15:06 +02:00 committed by GitHub
parent b0f3c82826
commit 98aa83893b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 14 deletions

View file

@ -770,8 +770,7 @@ impl cosmic::Application for Audio {
slider(0.0..=150.0, self.output_volume, Message::SetOutputVolume) slider(0.0..=150.0, self.output_volume, Message::SetOutputVolume)
.width(Length::FillPortion(5)) .width(Length::FillPortion(5))
.breakpoints(&[100.]), .breakpoints(&[100.]),
text(&self.output_volume_text) container(text(&self.output_volume_text).size(16))
.size(16)
.width(Length::FillPortion(1)) .width(Length::FillPortion(1))
.align_x(Alignment::End) .align_x(Alignment::End)
] ]
@ -792,8 +791,7 @@ impl cosmic::Application for Audio {
slider(0.0..=150.0, self.input_volume, Message::SetInputVolume) slider(0.0..=150.0, self.input_volume, Message::SetInputVolume)
.width(Length::FillPortion(5)) .width(Length::FillPortion(5))
.breakpoints(&[100.]), .breakpoints(&[100.]),
text(&self.input_volume_text) container(text(&self.input_volume_text).size(16))
.size(16)
.width(Length::FillPortion(1)) .width(Length::FillPortion(1))
.align_x(Alignment::End) .align_x(Alignment::End)
] ]

View file

@ -43,6 +43,7 @@ use cosmic_settings_subscriptions::{
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
use std::{collections::HashMap, path::PathBuf, time::Duration}; use std::{collections::HashMap, path::PathBuf, time::Duration};
use cosmic::widget::text_input;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
// XXX improve // XXX improve
@ -632,11 +633,13 @@ impl cosmic::Application for CosmicBatteryApplet {
Message::SetScreenBrightness Message::SetScreenBrightness
) )
.on_release(Message::ReleaseScreenBrightness), .on_release(Message::ReleaseScreenBrightness),
text(format!( container(
"{:.0}%", text(format!(
self.screen_brightness_percent().unwrap_or(0.) * 100. "{:.0}%",
)) self.screen_brightness_percent().unwrap_or(0.) * 100.
.size(16) ))
.size(16)
)
.width(Length::Fixed(40.0)) .width(Length::Fixed(40.0))
.align_x(Alignment::End) .align_x(Alignment::End)
] ]
@ -661,11 +664,13 @@ impl cosmic::Application for CosmicBatteryApplet {
Message::SetKbdBrightness Message::SetKbdBrightness
) )
.on_release(Message::ReleaseKbdBrightness), .on_release(Message::ReleaseKbdBrightness),
text(format!( container(
"{:.0}%", text(format!(
100. * kbd_brightness as f64 / max_kbd_brightness as f64 "{:.0}%",
)) 100. * kbd_brightness as f64 / max_kbd_brightness as f64
.size(16) ))
.size(16)
)
.width(Length::Fixed(40.0)) .width(Length::Fixed(40.0))
.align_x(Alignment::End) .align_x(Alignment::End)
] ]