opt: video cover

This commit is contained in:
bggRGjQaUbCoE
2024-09-25 16:56:53 +08:00
parent af66f6d1c6
commit e7af9b0ab3
3 changed files with 21 additions and 11 deletions

View File

@@ -122,14 +122,18 @@ class _ListSheetContentState extends State<ListSheetContent> {
} }
SmartDialog.showToast('切换到:$title'); SmartDialog.showToast('切换到:$title');
widget.onClose(); widget.onClose();
if (episode is bangumi.EpisodeItem && episode.cover != null) { widget.changeFucCall(
widget.changeFucCall( episode.runtimeType.toString() == "EpisodeItem"
episode.bvid, episode.cid, episode.aid, episode.cover); ? episode.bvid
} else if (episode.runtimeType.toString() == "EpisodeItem") { : widget.bvid,
widget.changeFucCall(episode.bvid, episode.cid, episode.aid, null); episode.cid,
} else { episode.aid,
widget.changeFucCall(widget.bvid!, episode.cid, widget.aid!, null); episode is video.EpisodeItem
} ? episode.arc?.pic
: episode is bangumi.EpisodeItem
? episode.cover
: null,
);
}, },
dense: false, dense: false,
leading: (episode is video.EpisodeItem && episode.arc?.pic != null) || leading: (episode is video.EpisodeItem && episode.arc?.pic != null) ||

View File

@@ -254,7 +254,6 @@ class VideoHttp {
return { return {
'status': true, 'status': true,
'data': result.data!, 'data': result.data!,
'pic': result.data?.pic ?? '',
}; };
} else { } else {
// Map errMap = { // Map errMap = {

View File

@@ -123,7 +123,14 @@ class VideoIntroController extends GetxController {
var result = await VideoHttp.videoIntro(bvid: bvid); var result = await VideoHttp.videoIntro(bvid: bvid);
if (result['status']) { if (result['status']) {
videoDetail.value = result['data']!; videoDetail.value = result['data']!;
videoDetailController.videoItem['pic'] = result['pic']!; if (videoDetailController.videoItem['pic'] == null ||
videoDetailController.videoItem['pic'] == '') {
try {
videoDetailController.videoItem['pic'] = result['data'].pic;
} catch (e) {
debugPrint(e.toString());
}
}
if (videoDetail.value.pages != null && if (videoDetail.value.pages != null &&
videoDetail.value.pages!.isNotEmpty && videoDetail.value.pages!.isNotEmpty &&
lastPlayCid.value == 0) { lastPlayCid.value == 0) {
@@ -475,7 +482,7 @@ class VideoIntroController extends GetxController {
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid); videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
videoDetailCtr.cid.value = cid; videoDetailCtr.cid.value = cid;
if (cover is String && cover.isNotEmpty) { if (cover is String && cover.isNotEmpty) {
videoItem!['pic'] = cover; videoDetailCtr.videoItem['pic'] = cover;
} }
videoDetailCtr.danmakuCid.value = cid; videoDetailCtr.danmakuCid.value = cid;
videoDetailCtr.queryVideoUrl(); videoDetailCtr.queryVideoUrl();