feat: change progress display

This commit is contained in:
Simon Ding
2024-07-31 16:55:01 +08:00
parent b337e40fcc
commit 1340305f2d
3 changed files with 51 additions and 34 deletions

View File

@@ -7,7 +7,7 @@ import 'package:ui/providers/APIs.dart';
import 'package:ui/providers/server_response.dart';
final tvWatchlistDataProvider = FutureProvider.autoDispose((ref) async {
final dio = APIs.getDio();
final dio = APIs.getDio();
var resp = await dio.get(APIs.watchlistTvUrl);
var sp = ServerResponse.fromJson(resp.data);
List<MediaDetail> favList = List.empty(growable: true);
@@ -155,22 +155,23 @@ class MediaDetail {
String? resolution;
int? storageId;
String? airDate;
String? status;
int? monitoredNum;
int? downloadedNum;
MediaDetail({
this.id,
this.tmdbId,
this.mediaType,
this.name,
this.originalName,
this.overview,
this.posterPath,
this.createdAt,
this.resolution,
this.storageId,
this.airDate,
this.status,
});
MediaDetail(
{this.id,
this.tmdbId,
this.mediaType,
this.name,
this.originalName,
this.overview,
this.posterPath,
this.createdAt,
this.resolution,
this.storageId,
this.airDate,
this.monitoredNum,
this.downloadedNum});
MediaDetail.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -184,7 +185,8 @@ class MediaDetail {
resolution = json["resolution"];
storageId = json["storage_id"];
airDate = json["air_date"];
status = json["status"];
monitoredNum = json["monitored_num"]??0;
downloadedNum = json["download_num"]??0;
}
}

View File

@@ -40,7 +40,7 @@ class WelcomePage extends ConsumerWidget {
))
]
: List.generate(value.length, (i) {
var item = value[i];
final item = value[i];
return Card(
margin: const EdgeInsets.all(4),
clipBehavior: Clip.hardEdge,
@@ -68,14 +68,15 @@ class WelcomePage extends ConsumerWidget {
children: [
LinearProgressIndicator(
value: 1,
color: item.status == "downloaded"
color: item.downloadedNum ==
item.monitoredNum
? Colors.green
: Colors.blue,
),
Text(
item.name!,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
height: 2.5),