opt: 字幕按钮显隐逻辑
This commit is contained in:
@ -141,13 +141,7 @@ class VideoDetailController extends GetxController
|
|||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
floating = Floating();
|
floating = Floating();
|
||||||
}
|
}
|
||||||
headerControl = HeaderControl(
|
|
||||||
controller: plPlayerController,
|
|
||||||
videoDetailCtr: this,
|
|
||||||
floating: floating,
|
|
||||||
bvid: bvid,
|
|
||||||
videoType: videoType,
|
|
||||||
);
|
|
||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||||
// 预设的画质
|
// 预设的画质
|
||||||
@ -158,7 +152,18 @@ class VideoDetailController extends GetxController
|
|||||||
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
||||||
defaultValue: AudioQuality.hiRes.code);
|
defaultValue: AudioQuality.hiRes.code);
|
||||||
oid.value = IdUtils.bv2av(Get.parameters['bvid']!);
|
oid.value = IdUtils.bv2av(Get.parameters['bvid']!);
|
||||||
getSubtitle();
|
getSubtitle().then(
|
||||||
|
(subtitles) {
|
||||||
|
headerControl = HeaderControl(
|
||||||
|
controller: plPlayerController,
|
||||||
|
videoDetailCtr: this,
|
||||||
|
floating: floating,
|
||||||
|
bvid: bvid,
|
||||||
|
videoType: videoType,
|
||||||
|
showSubtitleBtn: subtitles.isNotEmpty,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showReplyReplyPanel(oid, fRpid, firstFloor, currentReply, loadMore) {
|
showReplyReplyPanel(oid, fRpid, firstFloor, currentReply, loadMore) {
|
||||||
@ -432,6 +437,14 @@ class VideoDetailController extends GetxController
|
|||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (result['data'].subtitles.isNotEmpty) {
|
if (result['data'].subtitles.isNotEmpty) {
|
||||||
subtitles = result['data'].subtitles;
|
subtitles = result['data'].subtitles;
|
||||||
|
getDanmaku(subtitles);
|
||||||
|
}
|
||||||
|
return subtitles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取弹幕
|
||||||
|
Future getDanmaku(List subtitles) async {
|
||||||
if (subtitles.isNotEmpty) {
|
if (subtitles.isNotEmpty) {
|
||||||
for (var i in subtitles) {
|
for (var i in subtitles) {
|
||||||
final Map<String, dynamic> res = await VideoHttp.getSubtitleContent(
|
final Map<String, dynamic> res = await VideoHttp.getSubtitleContent(
|
||||||
@ -442,9 +455,6 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result['data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setSubtitleContent() {
|
setSubtitleContent() {
|
||||||
plPlayerController.subtitleContent.value = '';
|
plPlayerController.subtitleContent.value = '';
|
||||||
|
|||||||
@ -30,6 +30,7 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
this.floating,
|
this.floating,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
this.videoType,
|
this.videoType,
|
||||||
|
this.showSubtitleBtn,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
final PlPlayerController? controller;
|
final PlPlayerController? controller;
|
||||||
@ -37,6 +38,7 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
final Floating? floating;
|
final Floating? floating;
|
||||||
final String? bvid;
|
final String? bvid;
|
||||||
final SearchType? videoType;
|
final SearchType? videoType;
|
||||||
|
final bool? showSubtitleBtn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HeaderControl> createState() => _HeaderControlState();
|
State<HeaderControl> createState() => _HeaderControlState();
|
||||||
@ -1327,6 +1329,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/// 字幕
|
/// 字幕
|
||||||
|
if (widget.showSubtitleBtn!)
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.closed_caption_off,
|
Icons.closed_caption_off,
|
||||||
|
|||||||
Reference in New Issue
Block a user