Skip to content

Commit cff83e4

Browse files
committed
fix: null
1 parent 9b7527d commit cff83e4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ui/lib/activity.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
143143
children: [
144144
Text("开始时间:${timeago.format(ac.date!)}"),
145145
Text("大小:${(ac.size ?? 0).readableFileSize()}"),
146-
ac.seedRatio > 0
146+
(ac.seedRatio??0) > 0
147147
? Text("分享率:${ac.seedRatio}")
148148
: SizedBox()
149149
],

ui/lib/providers/activity.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,23 @@ class Activity {
110110
final String? saved;
111111
final int? progress;
112112
final int? size;
113-
final double seedRatio;
114-
final double uploadProgress;
113+
final double? seedRatio;
114+
final double? uploadProgress;
115115

116116
factory Activity.fromJson(Map<String, dynamic> json) {
117117
return Activity(
118118
id: json["id"],
119119
mediaId: json["media_id"],
120120
episodeId: json["episode_id"],
121121
sourceTitle: json["source_title"],
122-
date: DateTime.tryParse(json["date"] ?? ""),
122+
date: DateTime.tryParse(json["date"] ?? DateTime.now().toString()),
123123
targetDir: json["target_dir"],
124124
status: json["status"],
125125
saved: json["saved"],
126-
progress: json["progress"],
127-
seedRatio: json["seed_ratio"],
128-
size: json["size"],
129-
uploadProgress: json["upload_progress"]);
126+
progress: json["progress"]??0,
127+
seedRatio: json["seed_ratio"]??0,
128+
size: json["size"]??0,
129+
uploadProgress: json["upload_progress"]??0);
130130
}
131131
}
132132

0 commit comments

Comments
 (0)