feat: show filename under thumbnail

This commit is contained in:
electria 2026-08-09 13:43:04 -07:00
commit 6312d0a610
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -110,7 +110,7 @@ impl State {
widget::column([ widget::column([
widget::scrollable( widget::scrollable(
widget::grid(self.images.iter().map(|(path, opt_handle)| { widget::grid(self.images.iter().map(|(path, opt_handle)| {
widget::button( widget::button(widget::column([
widget::container( widget::container(
widget::sensor(opt_handle.as_ref().map_or_else( widget::sensor(opt_handle.as_ref().map_or_else(
|| Element::from(widget::space()), || Element::from(widget::space()),
@ -119,8 +119,17 @@ impl State {
.on_show(|_size| Message::LoadImage(path.clone())) .on_show(|_size| Message::LoadImage(path.clone()))
.on_hide(Message::UnloadImage(path.clone())), .on_hide(Message::UnloadImage(path.clone())),
) )
.center(Length::Fill), .center(Length::Fill)
.into(),
widget::text(
path.file_name()
.map_or(Cow::Borrowed("[no file]"), |extension| {
extension.to_string_lossy()
}),
) )
.center()
.into(),
]))
.style(widget::button::subtle) .style(widget::button::subtle)
.on_press(Message::OpenImage(path.clone())) .on_press(Message::OpenImage(path.clone()))
.into() .into()