Add copy original image url to clipboard for thumbnail

This commit is contained in:
2024-06-02 10:56:40 +00:00
committed by GitHub
parent 6d0e7d747d
commit bb4e725688
4 changed files with 43 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ class ImageWithContextMenu extends StatelessWidget {
const ImageWithContextMenu(this.data,
{super.key,
this.uri,
this.originalUri,
this.dir,
this.fileName,
this.fmt = ImageFmt.jpg,
@@ -21,6 +22,7 @@ class ImageWithContextMenu extends StatelessWidget {
this.changeAd});
final Uint8List data;
final String? uri;
final String? originalUri;
final ImageFmt fmt;
final String? fileName;
final String? dir;
@@ -65,6 +67,16 @@ class ImageWithContextMenu extends StatelessWidget {
}
}));
}
if (originalUri != null) {
list.add(MenuAction(
title: AppLocalizations.of(context)!.copyOriImgUrl,
callback: () {
copyTextToClipboard(originalUri!).catchError((err) {
_log.warning(
"Failed to copy original image to clipboard:", err);
});
}));
}
if ((isNsfw != null && changeNsfw != null) ||
(isAd != null && changeAd != null)) {
list.add(MenuSeparator());