Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2026-01-05 14:21:59 +08:00
parent c226f8f6df
commit 5a0b045a1f
14 changed files with 232 additions and 71 deletions

View File

@@ -273,8 +273,8 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
onDoubleTap,
),
onLongPress: !isFileImg ? () => onLongPress(item) : null,
onSecondaryTap: !isFileImg && !PlatformUtils.isMobile
? () => onLongPress(item)
onSecondaryTapUp: PlatformUtils.isDesktop && !isFileImg
? (e) => _showDesktopMenu(e.globalPosition, item)
: null,
child: widget.itemBuilder != null
? widget.itemBuilder!(
@@ -479,9 +479,9 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
);
},
dense: true,
title: const Text(
'保存 Live Photo',
style: TextStyle(fontSize: 14),
title: Text(
'保存${Platform.isIOS ? ' Live Photo' : '视频'}',
style: const TextStyle(fontSize: 14),
),
),
],
@@ -490,4 +490,40 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
},
);
}
void _showDesktopMenu(Offset offset, SourceModel item) {
showMenu(
context: context,
position: RelativeRect.fromLTRB(offset.dx, offset.dy, offset.dx, 0),
items: [
PopupMenuItem(
height: 42,
onTap: () => Utils.copyText(item.url),
child: const Text('复制链接', style: TextStyle(fontSize: 14)),
),
PopupMenuItem(
height: 42,
onTap: () => ImageUtils.downloadImg(context, [item.url]),
child: const Text('保存图片', style: TextStyle(fontSize: 14)),
),
PopupMenuItem(
height: 42,
onTap: () => PageUtils.launchURL(item.url),
child: const Text('网页打开', style: TextStyle(fontSize: 14)),
),
if (item.sourceType == SourceType.livePhoto)
PopupMenuItem(
height: 42,
onTap: () => ImageUtils.downloadLivePhoto(
context: context,
url: item.url,
liveUrl: item.liveUrl!,
width: item.width!,
height: item.height!,
),
child: const Text('保存视频', style: TextStyle(fontSize: 14)),
),
],
);
}
}