mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-08-16 08:18:04 +08:00
https://github.com/StarCitizenToolBox/app/issues/1 分流下载:增加一种快速恢复卡住的下载的方法。
This commit is contained in:
@@ -36,13 +36,21 @@ class DownloaderDialogUI extends BaseUI<DownloaderDialogUIModel> {
|
||||
const SizedBox(width: 24),
|
||||
],
|
||||
),
|
||||
if (model.isP4kDownload) ...[
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
"提示:因网络波动,若下载进度长时间卡住或速度变慢,可尝试点击暂停下载,之后重新点击P4K分流下载。",
|
||||
style:
|
||||
TextStyle(fontSize: 13, color: Colors.white.withOpacity(.7)),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
FilledButton(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2),
|
||||
child: Text("取消下载"),
|
||||
child: Text("暂停下载"),
|
||||
),
|
||||
onPressed: () => model.doCancel()),
|
||||
],
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/ffi.dart';
|
||||
|
||||
@@ -10,9 +11,12 @@ class DownloaderDialogUIModel extends BaseUIModel {
|
||||
final String downloadUrl;
|
||||
final bool showChangeSavePathDialog;
|
||||
final int threadCount;
|
||||
final bool isP4kDownload;
|
||||
|
||||
DownloaderDialogUIModel(this.fileName, this.savePath, this.downloadUrl,
|
||||
{this.showChangeSavePathDialog = false, this.threadCount = 1});
|
||||
{this.showChangeSavePathDialog = false,
|
||||
this.threadCount = 1,
|
||||
this.isP4kDownload = false});
|
||||
|
||||
bool isInMerging = false;
|
||||
|
||||
@@ -52,8 +56,15 @@ class DownloaderDialogUIModel extends BaseUIModel {
|
||||
savePath = savePath.substring(0, savePath.length - fileName.length - 1);
|
||||
}
|
||||
|
||||
final downloaderSavePath = "$savePath//$fileName.downloading";
|
||||
if (isP4kDownload) {
|
||||
final box = await Hive.openBox("p4k_cache");
|
||||
await box.put(
|
||||
"last_save_dir",
|
||||
{"save_path": savePath, "file_name": fileName},
|
||||
);
|
||||
}
|
||||
|
||||
final downloaderSavePath = "$savePath//$fileName.downloading";
|
||||
try {
|
||||
rustFii
|
||||
.startDownload(
|
||||
|
Reference in New Issue
Block a user