fix: videoDetail cover null

This commit is contained in:
guozhigq
2024-04-28 22:27:14 +08:00
parent 21fe663add
commit b06b1d8a8a
3 changed files with 16 additions and 14 deletions

View File

@ -115,20 +115,15 @@ class VideoDetailController extends GetxController
super.onInit();
final Map argMap = Get.arguments;
userInfo = userInfoCache.get('userInfoCache');
var keys = argMap.keys.toList();
if (keys.isNotEmpty) {
if (keys.contains('videoItem')) {
var args = argMap['videoItem'];
if (args.pic != null && args.pic != '') {
videoItem['pic'] = args.pic;
cover.value = args.pic;
}
}
if (keys.contains('pic')) {
videoItem['pic'] = argMap['pic'];
cover.value = argMap['pic'];
}
if (argMap.containsKey('videoItem')) {
var args = argMap['videoItem'];
updateCover(args.pic);
}
if (argMap.containsKey('pic')) {
updateCover(argMap['pic']);
}
tabCtr = TabController(length: 2, vsync: this);
autoPlay.value =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
@ -551,4 +546,10 @@ class VideoDetailController extends GetxController
},
);
}
void updateCover(String? pic) {
if (pic != null && pic != '') {
cover.value = videoItem['pic'] = pic;
}
}
}

View File

@ -90,6 +90,7 @@ class VideoIntroController extends GetxController {
final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag);
videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
videoDetailCtr.cover.value = result['data'].pic ?? '';
// 获取到粉丝数再返回
await queryUserStat();
}

View File

@ -117,7 +117,7 @@ class PiliSchame {
// ignore: always_specify_types
(e) => Get.toNamed<dynamic>('/video?bvid=$bvid&cid=$cid',
arguments: <String, String?>{
'pic': null,
'pic': '',
'heroTag': heroTag,
}),
);