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(); super.onInit();
final Map argMap = Get.arguments; final Map argMap = Get.arguments;
userInfo = userInfoCache.get('userInfoCache'); userInfo = userInfoCache.get('userInfoCache');
var keys = argMap.keys.toList(); if (argMap.containsKey('videoItem')) {
if (keys.isNotEmpty) { var args = argMap['videoItem'];
if (keys.contains('videoItem')) { updateCover(args.pic);
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('pic')) {
updateCover(argMap['pic']);
}
tabCtr = TabController(length: 2, vsync: this); tabCtr = TabController(length: 2, vsync: this);
autoPlay.value = autoPlay.value =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); 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 = final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag); Get.find<VideoDetailController>(tag: heroTag);
videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}']; videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
videoDetailCtr.cover.value = result['data'].pic ?? '';
// 获取到粉丝数再返回 // 获取到粉丝数再返回
await queryUserStat(); await queryUserStat();
} }

View File

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