🏡 index : ~doyle/shalom.git

author Jordan Doyle <jordan@doyle.la> 2024-01-03 11:24:13.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-01-03 11:24:13.0 +00:00:00
commit
5c71c384510c4a8570fb9ac0cc58950656c7aed6 [patch]
tree
ecbb3b47c541580e614159891e13e2b7f9d1f085
parent
50b58aa73061672c92cc284b288910ec580c913d
download
5c71c384510c4a8570fb9ac0cc58950656c7aed6.tar.gz

Prevent content shifts on media player by duration



Diff

 shalom/src/widgets/media_player.rs |  9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/shalom/src/widgets/media_player.rs b/shalom/src/widgets/media_player.rs
index 3a34173..f11189f 100644
--- a/shalom/src/widgets/media_player.rs
+++ b/shalom/src/widgets/media_player.rs
@@ -227,17 +227,20 @@ impl<M: Clone> Component<M, Renderer> for MediaPlayer<M> {
                    row![
                        text(format_time(position))
                            .style(Text::Color(SLATE_400))
                            .size(12),
                            .size(12)
                            .width(Length::FillPortion(10)),
                        slider(
                            0.0..=self.device.media_duration.unwrap_or_default().as_secs_f64(),
                            position.as_secs_f64(),
                            Event::PositionChange
                        )
                        .on_release(Event::OnPositionRelease)
                        .style(Slider::Custom(Box::new(SliderStyle))),
                        .style(Slider::Custom(Box::new(SliderStyle)))
                        .width(Length::FillPortion(80)),
                        text(format_time(self.device.media_duration.unwrap_or_default()))
                            .style(Text::Color(SLATE_400))
                            .size(12),
                            .size(12)
                            .width(Length::FillPortion(10)),
                    ]
                    .spacing(14)
                    .align_items(Alignment::Center),