diff --git a/lib/helpers/extensions/show_image_viewer.dart b/lib/helpers/extensions/show_image_viewer.dart index 9be95b8..366d1e2 100644 --- a/lib/helpers/extensions/show_image_viewer.dart +++ b/lib/helpers/extensions/show_image_viewer.dart @@ -10,7 +10,7 @@ import "package:nexus/widgets/common/error_dialog.dart"; extension ShowImageViewer on BuildContext { /// Shows the image from [request] fullscreen, zoomable. /// - /// If [downloadFilename] is set, a download button is shown, suggesting it. + /// The download button suggests [downloadFilename], falling back to the media ID. void showImageViewer( WidgetRef ref, DownloadMediaRequest request, { @@ -58,16 +58,15 @@ extension ShowImageViewer on BuildContext { mainAxisSize: .min, spacing: 8, children: [ - if (downloadFilename != null) - M3EButton( - onPressed: () => context.saveAttachment( - ref, - request.mxc, - encrypted: request.encrypted, - filename: downloadFilename, - ), - child: Icon(Icons.download), + M3EButton( + onPressed: () => context.saveAttachment( + ref, + request.mxc, + encrypted: request.encrypted, + filename: downloadFilename, ), + child: Icon(Icons.download), + ), M3EButton( onPressed: Navigator.of(context).pop, child: Icon(Icons.close), diff --git a/lib/widgets/common/expandable_image.dart b/lib/widgets/common/expandable_image.dart index 34a1f76..d034b62 100644 --- a/lib/widgets/common/expandable_image.dart +++ b/lib/widgets/common/expandable_image.dart @@ -7,7 +7,7 @@ final class const ExpandableImage( final DownloadMediaRequest? request, { required final Widget child, - /// If set, a download button is shown, suggesting this filename + /// Suggested filename when downloading, falling back to the media ID final String? downloadFilename, final int? size, super.key, diff --git a/lib/widgets/html/html.dart b/lib/widgets/html/html.dart index 06e3ebb..76b656e 100644 --- a/lib/widgets/html/html.dart +++ b/lib/widgets/html/html.dart @@ -98,7 +98,6 @@ class const Html( alignment: .middle, child: ExpandableImage( .new(mxc: src), - downloadFilename: src.pathSegments.last, child: Image( image: MxcImage(ref, .new(mxc: src)), errorBuilder: (_, error, _) => Text( diff --git a/lib/widgets/reactions/reactions_popover.dart b/lib/widgets/reactions/reactions_popover.dart index c1200c3..e8e475c 100644 --- a/lib/widgets/reactions/reactions_popover.dart +++ b/lib/widgets/reactions/reactions_popover.dart @@ -68,7 +68,6 @@ class const ReactionsPopover( void expand() => context.showImageViewer( ref, .new(mxc: Uri.parse(reaction)), - downloadFilename: reaction.split("/").last, ); final isImage = reaction.startsWith("mxc://");