✨ Allow export to jpegs even if not download finish
This commit is contained in:
parent
4f2c4ec90d
commit
09e6b3b659
|
@ -567,6 +567,19 @@ class Method {
|
|||
});
|
||||
}
|
||||
|
||||
/// 导出下载的图片到HTML+JPG (即使没有下载完成)
|
||||
Future<dynamic> exportComicJpegsEvenNotFinish(
|
||||
String comicId,
|
||||
String dir,
|
||||
String name,
|
||||
) {
|
||||
return _flatInvoke("exportComicJpegsEvenNotFinish", {
|
||||
"comicId": comicId,
|
||||
"dir": dir,
|
||||
"name": name,
|
||||
});
|
||||
}
|
||||
|
||||
/// 导出下载的图片到HTML+JPG
|
||||
Future<dynamic> exportComicDownloadToJPG(
|
||||
String comicId,
|
||||
|
|
|
@ -351,6 +351,59 @@ class _DownloadExportToFileScreenState
|
|||
child: _buildButtonInner('导出到HTML.zip\n(可从其他设备导入 / 解压后可阅读)'),
|
||||
));
|
||||
widgets.add(Container(height: 10));
|
||||
//////////////////////
|
||||
widgets.add(MaterialButton(
|
||||
onPressed: () async {
|
||||
late String? path;
|
||||
try {
|
||||
path = Platform.isIOS
|
||||
? await method.iosGetDocumentDir()
|
||||
: await chooseFolder(context);
|
||||
} catch (e) {
|
||||
defaultToast(context, "$e");
|
||||
return;
|
||||
}
|
||||
var name = "";
|
||||
if (currentExportRename()) {
|
||||
var rename = await inputString(
|
||||
context,
|
||||
"请输入保存后的名称",
|
||||
defaultValue: _task.title,
|
||||
);
|
||||
if (rename != null && rename.isNotEmpty) {
|
||||
name = rename;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
print("path $path");
|
||||
if (path != null) {
|
||||
try {
|
||||
setState(() {
|
||||
exporting = true;
|
||||
});
|
||||
await method.exportComicJpegsEvenNotFinish(
|
||||
widget.comicId,
|
||||
path,
|
||||
name,
|
||||
);
|
||||
setState(() {
|
||||
exportResult = "导出成功";
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
exportResult = "导出失败 $e";
|
||||
});
|
||||
} finally {
|
||||
setState(() {
|
||||
exporting = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
child: _buildButtonInner('导出到HTML+JPG\n(即使没有下载成功)'),
|
||||
));
|
||||
widgets.add(Container(height: 10));
|
||||
}
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
widgets.add(MaterialButton(
|
||||
|
|
Loading…
Reference in New Issue