fix: 字幕req导致headerControl初始化异常

This commit is contained in:
guozhigq
2024-07-07 22:27:28 +08:00
parent 0a0d375caa
commit aab5144371
2 changed files with 8 additions and 15 deletions

View File

@ -152,17 +152,13 @@ class VideoDetailController extends GetxController
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
defaultValue: AudioQuality.hiRes.code);
oid.value = IdUtils.bv2av(Get.parameters['bvid']!);
getSubtitle().then(
(subtitles) {
headerControl = HeaderControl(
controller: plPlayerController,
videoDetailCtr: this,
floating: floating,
bvid: bvid,
videoType: videoType,
showSubtitleBtn: subtitles.isNotEmpty,
);
},
getSubtitle();
headerControl = HeaderControl(
controller: plPlayerController,
videoDetailCtr: this,
floating: floating,
bvid: bvid,
videoType: videoType,
);
}
@ -439,9 +435,6 @@ class VideoDetailController extends GetxController
subtitles = result['data'].subtitles;
getDanmaku(subtitles);
}
return subtitles;
} else {
return [];
}
}

View File

@ -1329,7 +1329,7 @@ class _HeaderControlState extends State<HeaderControl> {
],
/// 字幕
if (widget.showSubtitleBtn!)
if (widget.showSubtitleBtn ?? true)
ComBtn(
icon: const Icon(
Icons.closed_caption_off,