diff --git a/lib/basic/Method.dart b/lib/basic/Method.dart index 7d12c99..18406fd 100644 --- a/lib/basic/Method.dart +++ b/lib/basic/Method.dart @@ -567,12 +567,25 @@ class Method { }); } + /// 导出下载的图片到HTML+JPG (即使没有下载完成) + Future exportComicJpegsEvenNotFinish( + String comicId, + String dir, + String name, + ) { + return _flatInvoke("exportComicJpegsEvenNotFinish", { + "comicId": comicId, + "dir": dir, + "name": name, + }); + } + /// 导出下载的图片到HTML+JPG Future exportComicDownloadToJPG( - String comicId, - String dir, - String name, - ) { + String comicId, + String dir, + String name, + ) { return _flatInvoke("exportComicDownloadToJPG", { "comicId": comicId, "dir": dir, diff --git a/lib/screens/DownloadExportToFileScreen.dart b/lib/screens/DownloadExportToFileScreen.dart index df7ce66..80d9b77 100644 --- a/lib/screens/DownloadExportToFileScreen.dart +++ b/lib/screens/DownloadExportToFileScreen.dart @@ -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(