Re-center the contents of the Lyrics

This commit is contained in:
Emi Simpson 2022-01-07 18:16:59 -05:00
parent b715155b20
commit b5c1b088f3
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,4 @@
use iced::Container;
use iced::Length;
use iced::Element;
use crate::styles::Theme;
@ -87,12 +88,17 @@ impl Lyrics {
pub fn view(&mut self, theme: Theme) -> Element<Message> {
let is_sole_line = self.lines.len() == 1;
self.lines.iter_mut()
let scroller = self.lines.iter_mut()
.enumerate()
.map(|(i, l)| l.view(is_sole_line, i, theme))
.fold(Scrollable::new(&mut self.scroll_state), |s, l| s.push(l))
.width(Length::Fill)
.align_items(Align::Center)
.align_items(Align::Center);
Container::new(scroller)
.height(Length::Fill)
.width(Length::Fill)
.center_y()
.into()
}
}