mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 15:08:18 -07:00
feat: Add download speed to progress bar
This commit is contained in:
parent
d22d340181
commit
5a5a4e4703
7 changed files with 95 additions and 68 deletions
|
|
@ -4,11 +4,13 @@ class DownloadStream {
|
|||
final String id;
|
||||
final dl.DownloadTask? task;
|
||||
final double progress;
|
||||
final String downloadSpeed;
|
||||
final dl.TaskStatus status;
|
||||
DownloadStream({
|
||||
required this.id,
|
||||
this.task,
|
||||
required this.progress,
|
||||
this.progress = -1,
|
||||
this.downloadSpeed = "",
|
||||
required this.status,
|
||||
});
|
||||
|
||||
|
|
@ -16,6 +18,7 @@ class DownloadStream {
|
|||
: id = '',
|
||||
task = null,
|
||||
progress = -1,
|
||||
downloadSpeed = "",
|
||||
status = dl.TaskStatus.notFound;
|
||||
|
||||
bool get hasDownload => progress != -1.0 && status != dl.TaskStatus.notFound && status != dl.TaskStatus.complete;
|
||||
|
|
@ -24,12 +27,14 @@ class DownloadStream {
|
|||
String? id,
|
||||
dl.DownloadTask? task,
|
||||
double? progress,
|
||||
String? downloadSpeed,
|
||||
dl.TaskStatus? status,
|
||||
}) {
|
||||
return DownloadStream(
|
||||
id: id ?? this.id,
|
||||
task: task ?? this.task,
|
||||
progress: progress ?? this.progress,
|
||||
downloadSpeed: downloadSpeed ?? this.downloadSpeed,
|
||||
status: status ?? this.status,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,10 +82,6 @@ abstract class SyncedItem with _$SyncedItem {
|
|||
_ => TaskStatus.notFound,
|
||||
};
|
||||
|
||||
String? get taskId => task?.taskId;
|
||||
|
||||
bool get childHasTask => false;
|
||||
|
||||
double get totalProgress => 0.0;
|
||||
|
||||
bool get hasVideoFile => videoFileName?.isNotEmpty == true && (fileSize ?? 0) > 0;
|
||||
|
|
@ -94,10 +90,6 @@ abstract class SyncedItem with _$SyncedItem {
|
|||
return TaskStatus.notFound;
|
||||
}
|
||||
|
||||
double get downloadProgress => 0.0;
|
||||
TaskStatus get downloadStatus => TaskStatus.notFound;
|
||||
DownloadTask? get task => null;
|
||||
|
||||
Future<bool> deleteDatFiles(Ref ref) async {
|
||||
try {
|
||||
await videoFile.delete();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue