opt: simple dialog

This commit is contained in:
My-Responsitories
2026-06-13 11:58:33 +08:00
parent c63fe3866c
commit 3085d58508
26 changed files with 1184 additions and 1433 deletions

View File

@@ -534,76 +534,67 @@ class _GalleryViewerState extends State<GalleryViewer>
HapticFeedback.mediumImpact();
showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => SimpleDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (PlatformUtils.isMobile)
ListTile(
onTap: () {
Get.back();
ImageUtils.onShareImg(item.url);
},
dense: true,
title: const Text('分享', style: TextStyle(fontSize: 14)),
),
ListTile(
onTap: () {
children: [
if (PlatformUtils.isMobile)
SimpleDialogOption(
onPressed: () {
Get.back();
Utils.copyText(item.url);
ImageUtils.onShareImg(item.url);
},
dense: true,
title: const Text('复制链接', style: TextStyle(fontSize: 14)),
child: const Text('分享', style: TextStyle(fontSize: 14)),
),
ListTile(
onTap: () {
SimpleDialogOption(
onPressed: () {
Get.back();
Utils.copyText(item.url);
},
child: const Text('复制链接', style: TextStyle(fontSize: 14)),
),
SimpleDialogOption(
onPressed: () {
Get.back();
ImageUtils.downloadImg([item.url]);
},
child: const Text('保存图片', style: TextStyle(fontSize: 14)),
),
if (PlatformUtils.isDesktop)
SimpleDialogOption(
onPressed: () {
Get.back();
ImageUtils.downloadImg([item.url]);
PageUtils.launchURL(item.url);
},
dense: true,
title: const Text('保存图片', style: TextStyle(fontSize: 14)),
child: const Text('网页打开', style: TextStyle(fontSize: 14)),
)
else if (widget.sources.length > 1)
SimpleDialogOption(
onPressed: () {
Get.back();
ImageUtils.downloadImg(
widget.sources.map((item) => item.url).toList(),
);
},
child: const Text('保存全部图片', style: TextStyle(fontSize: 14)),
),
if (PlatformUtils.isDesktop)
ListTile(
onTap: () {
Get.back();
PageUtils.launchURL(item.url);
},
dense: true,
title: const Text('网页打开', style: TextStyle(fontSize: 14)),
)
else if (widget.sources.length > 1)
ListTile(
onTap: () {
Get.back();
ImageUtils.downloadImg(
widget.sources.map((item) => item.url).toList(),
);
},
dense: true,
title: const Text('保存全部图片', style: TextStyle(fontSize: 14)),
if (item.sourceType == SourceType.livePhoto)
SimpleDialogOption(
onPressed: () {
Get.back();
ImageUtils.downloadLivePhoto(
url: item.url,
liveUrl: item.liveUrl!,
width: item.width!,
height: item.height!,
);
},
child: Text(
'保存${Platform.isIOS ? ' Live Photo' : '视频'}',
style: const TextStyle(fontSize: 14),
),
if (item.sourceType == SourceType.livePhoto)
ListTile(
onTap: () {
Get.back();
ImageUtils.downloadLivePhoto(
url: item.url,
liveUrl: item.liveUrl!,
width: item.width!,
height: item.height!,
);
},
dense: true,
title: Text(
'保存${Platform.isIOS ? ' Live Photo' : '视频'}',
style: const TextStyle(fontSize: 14),
),
),
],
),
),
],
),
);
}