mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: save image: dissable dialog
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -334,7 +334,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
DownloadUtils.downloadImg(
|
DownloadUtils.downloadImg(
|
||||||
context,
|
context,
|
||||||
widget.sources[currentIndex!],
|
widget.sources as List<String>,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text("保存全部图片"),
|
child: const Text("保存全部图片"),
|
||||||
|
|||||||
@@ -93,10 +93,19 @@ class DownloadUtils {
|
|||||||
if (!await checkPermissionDependOnSdkInt(context)) {
|
if (!await checkPermissionDependOnSdkInt(context)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool dispose = false;
|
||||||
for (int i = 0; i < imgList.length; i++) {
|
for (int i = 0; i < imgList.length; i++) {
|
||||||
SmartDialog.showLoading(
|
SmartDialog.showLoading(
|
||||||
msg:
|
msg:
|
||||||
'正在下载原图${imgList.length > 1 ? '${i + 1}/${imgList.length}' : ''}');
|
'正在下载原图${imgList.length > 1 ? '${i + 1}/${imgList.length}' : ''}',
|
||||||
|
clickMaskDismiss: true,
|
||||||
|
onDismiss: () {
|
||||||
|
dispose = true;
|
||||||
|
if (i != imgList.length - 1) {
|
||||||
|
SmartDialog.showToast('已取消下载剩余图片');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
var response = await Request().get(
|
var response = await Request().get(
|
||||||
imgList[i],
|
imgList[i],
|
||||||
options: Options(responseType: ResponseType.bytes),
|
options: Options(responseType: ResponseType.bytes),
|
||||||
@@ -117,9 +126,12 @@ class DownloadUtils {
|
|||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
}
|
}
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
await SmartDialog.showToast('「$picName」已保存 ');
|
SmartDialog.showToast('「$picName」已保存 ');
|
||||||
} else {
|
} else {
|
||||||
await SmartDialog.showToast('保存失败,${result.errorMessage}');
|
SmartDialog.showToast('保存失败,${result.errorMessage}');
|
||||||
|
}
|
||||||
|
if (dispose) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user