adding scrollable
This commit is contained in:
parent
40580a6e7a
commit
d2394c6540
|
@ -8,7 +8,7 @@ use cosmic::{
|
||||||
theme,
|
theme,
|
||||||
widget::{
|
widget::{
|
||||||
button, container, horizontal_space, icon, mouse_area, row,
|
button, container, horizontal_space, icon, mouse_area, row,
|
||||||
text, Column, Container, Space,
|
scrollable, text, Column, Container, Space,
|
||||||
},
|
},
|
||||||
Element, Task,
|
Element, Task,
|
||||||
};
|
};
|
||||||
|
@ -162,45 +162,53 @@ impl Library {
|
||||||
.on_enter(Message::HoverLibrary(Some(model.kind)))
|
.on_enter(Message::HoverLibrary(Some(model.kind)))
|
||||||
.on_exit(Message::HoverLibrary(None));
|
.on_exit(Message::HoverLibrary(None));
|
||||||
let lib_container = if self.library_open == Some(model.kind) {
|
let lib_container = if self.library_open == Some(model.kind) {
|
||||||
let items: Column<Message> = column({
|
let items = scrollable(
|
||||||
model.items.iter().map(|item| {
|
column({
|
||||||
let text =
|
model.items.iter().map(|item| {
|
||||||
text::heading(elide_text(item.title(), 18))
|
let text = text::heading(elide_text(
|
||||||
.center()
|
item.title(),
|
||||||
.wrapping(textm::Wrapping::None);
|
18,
|
||||||
let icon = icon::from_name({
|
))
|
||||||
match model.kind {
|
.center()
|
||||||
LibraryKind::Song => {
|
.wrapping(textm::Wrapping::None);
|
||||||
"folder-music-symbolic"
|
let icon = icon::from_name({
|
||||||
|
match model.kind {
|
||||||
|
LibraryKind::Song => {
|
||||||
|
"folder-music-symbolic"
|
||||||
|
}
|
||||||
|
LibraryKind::Video => {
|
||||||
|
"folder-videos-symbolic"
|
||||||
|
}
|
||||||
|
LibraryKind::Image => {
|
||||||
|
"folder-pictures-symbolic"
|
||||||
|
}
|
||||||
|
LibraryKind::Presentation => {
|
||||||
|
"x-office-presentation-symbolic"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LibraryKind::Video => {
|
});
|
||||||
"folder-videos-symbolic"
|
Container::new(rowm![icon, text].spacing(10))
|
||||||
}
|
.padding(5)
|
||||||
LibraryKind::Image => {
|
.width(Length::Fill)
|
||||||
"folder-pictures-symbolic"
|
.style(|t| {
|
||||||
}
|
container::Style::default()
|
||||||
LibraryKind::Presentation => {
|
.background(Background::Color(
|
||||||
"x-office-presentation-symbolic"
|
t.cosmic().button.base.into(),
|
||||||
}
|
))
|
||||||
}
|
.border(
|
||||||
});
|
Border::default().rounded(
|
||||||
Container::new(rowm![icon, text].spacing(10))
|
t.cosmic()
|
||||||
.padding(5)
|
.corner_radii
|
||||||
.width(Length::Fill)
|
.radius_l,
|
||||||
.style(|t| {
|
),
|
||||||
container::Style::default()
|
)
|
||||||
.background(Background::Color(
|
})
|
||||||
t.cosmic().button.base.into(),
|
.into()
|
||||||
))
|
})
|
||||||
.border(Border::default().rounded(
|
|
||||||
t.cosmic().corner_radii.radius_l,
|
|
||||||
))
|
|
||||||
})
|
|
||||||
.into()
|
|
||||||
})
|
})
|
||||||
})
|
.spacing(2)
|
||||||
.spacing(2)
|
.width(Length::Fill),
|
||||||
.width(Length::Fill);
|
);
|
||||||
Container::new(items).padding(5).style(|t| {
|
Container::new(items).padding(5).style(|t| {
|
||||||
container::Style::default()
|
container::Style::default()
|
||||||
.background(Background::Color(
|
.background(Background::Color(
|
||||||
|
|
Loading…
Reference in a new issue