forked from Nexus/nexus
make all ExpandableImages downloadable
There might have been a reason why I didn't do this but I don't remember it...
This commit is contained in:
parent
d5f04122eb
commit
dccbda7870
4 changed files with 10 additions and 13 deletions
|
|
@ -10,7 +10,7 @@ import "package:nexus/widgets/common/error_dialog.dart";
|
||||||
extension ShowImageViewer on BuildContext {
|
extension ShowImageViewer on BuildContext {
|
||||||
/// Shows the image from [request] fullscreen, zoomable.
|
/// 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(
|
void showImageViewer(
|
||||||
WidgetRef ref,
|
WidgetRef ref,
|
||||||
DownloadMediaRequest request, {
|
DownloadMediaRequest request, {
|
||||||
|
|
@ -58,7 +58,6 @@ extension ShowImageViewer on BuildContext {
|
||||||
mainAxisSize: .min,
|
mainAxisSize: .min,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
if (downloadFilename != null)
|
|
||||||
M3EButton(
|
M3EButton(
|
||||||
onPressed: () => context.saveAttachment(
|
onPressed: () => context.saveAttachment(
|
||||||
ref,
|
ref,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ final class const ExpandableImage(
|
||||||
final DownloadMediaRequest? request, {
|
final DownloadMediaRequest? request, {
|
||||||
required final Widget child,
|
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 String? downloadFilename,
|
||||||
final int? size,
|
final int? size,
|
||||||
super.key,
|
super.key,
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ class const Html(
|
||||||
alignment: .middle,
|
alignment: .middle,
|
||||||
child: ExpandableImage(
|
child: ExpandableImage(
|
||||||
.new(mxc: src),
|
.new(mxc: src),
|
||||||
downloadFilename: src.pathSegments.last,
|
|
||||||
child: Image(
|
child: Image(
|
||||||
image: MxcImage(ref, .new(mxc: src)),
|
image: MxcImage(ref, .new(mxc: src)),
|
||||||
errorBuilder: (_, error, _) => Text(
|
errorBuilder: (_, error, _) => Text(
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ class const ReactionsPopover(
|
||||||
void expand() => context.showImageViewer(
|
void expand() => context.showImageViewer(
|
||||||
ref,
|
ref,
|
||||||
.new(mxc: Uri.parse(reaction)),
|
.new(mxc: Uri.parse(reaction)),
|
||||||
downloadFilename: reaction.split("/").last,
|
|
||||||
);
|
);
|
||||||
final isImage = reaction.startsWith("mxc://");
|
final isImage = reaction.startsWith("mxc://");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue