feat(player): 进度条拖动预览改用雪碧图

This commit is contained in:
Zhou Weidong committed 2026-10-22 11:40:23 +08:00
1 parent 89a94f85c2
commit 12b733d111
16 files changed
+1312 -31

No files matched your search

+25 -12
View File
@@ -17,6 +17,7 @@ class Episode {
this.locked = false,
this.likeCount,
this.commentCount,
this.thumbnailsUrl,
});
final String id;
@@ -32,19 +33,25 @@ class Episode {
final bool locked;
final int? likeCount;
final int? commentCount;
final String? thumbnailsUrl;
Episode withVideoUrl(String url, {int? likeCount, int? commentCount}) =>
Episode(
id: id,
number: number,
title: title,
isFree: isFree,
videoUrl: url,
durationSec: durationSec,
locked: locked,
likeCount: likeCount ?? this.likeCount,
commentCount: commentCount ?? this.commentCount,
);
Episode withVideoUrl(
String url, {
int? likeCount,
int? commentCount,
String? thumbnailsUrl,
}) => Episode(
id: id,
number: number,
title: title,
isFree: isFree,
videoUrl: url,
durationSec: durationSec,
locked: locked,
likeCount: likeCount ?? this.likeCount,
commentCount: commentCount ?? this.commentCount,
thumbnailsUrl: thumbnailsUrl ?? this.thumbnailsUrl,
);
factory Episode.fromJson(Map<String, dynamic> json) {
return Episode(
@@ -57,6 +64,7 @@ class Episode {
videoUrl: json['playUrl'] as String? ?? '',
likeCount: _optionalInt(json['likeCount']),
commentCount: _optionalInt(json['commentCount']),
thumbnailsUrl: _optionalString(json['thumbnailsUrl']),
);
}
}
@@ -159,3 +167,8 @@ class Drama {
}
int? _optionalInt(dynamic value) => value == null ? null : jsonToInt(value);
String? _optionalString(dynamic value) {
final text = value is String ? value.trim() : '';
return text.isEmpty ? null : text;
}
+8
View File
@@ -14,6 +14,7 @@ class PlayTicket {
this.unlockCoin = 0,
this.previewSeconds = 0,
this.qualities = const [],
this.thumbnailsUrl,
this.likeCount,
this.commentCount,
});
@@ -40,6 +41,7 @@ class PlayTicket {
/// 后端下发的清晰度档位(如 AUTO / 720P / 1080P),HLS 由播放器自动切换。
final List<String> qualities;
final String? thumbnailsUrl;
final int? likeCount;
final int? commentCount;
@@ -62,6 +64,7 @@ class PlayTicket {
.whereType<String>()
.where((quality) => quality.isNotEmpty)
.toList(),
thumbnailsUrl: _optionalString(json['thumbnailsUrl']),
likeCount: json['likeCount'] == null
? null
: jsonToInt(json['likeCount']),
@@ -71,3 +74,8 @@ class PlayTicket {
);
}
}
String? _optionalString(dynamic value) {
final text = value is String ? value.trim() : '';
return text.isEmpty ? null : text;
}