opt: toggle showSubtitleBtn
This commit is contained in:
@ -480,6 +480,15 @@ class VideoDetailController extends GetxController
|
|||||||
getDanmaku(subtitles);
|
getDanmaku(subtitles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
headerControl = HeaderControl(
|
||||||
|
controller: plPlayerController,
|
||||||
|
videoDetailCtr: this,
|
||||||
|
floating: floating,
|
||||||
|
bvid: bvid,
|
||||||
|
videoType: videoType,
|
||||||
|
showSubtitleBtn: result['status'] && result['data'].subtitles.isNotEmpty,
|
||||||
|
);
|
||||||
|
plPlayerController.setHeaderControl(headerControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取弹幕
|
// 获取弹幕
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
this.floating,
|
this.floating,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
this.videoType,
|
this.videoType,
|
||||||
this.showSubtitleBtn,
|
this.showSubtitleBtn = true,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
final PlPlayerController? controller;
|
final PlPlayerController? controller;
|
||||||
@ -38,7 +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;
|
final bool showSubtitleBtn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HeaderControl> createState() => _HeaderControlState();
|
State<HeaderControl> createState() => _HeaderControlState();
|
||||||
@ -1326,7 +1326,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/// 字幕
|
/// 字幕
|
||||||
if (widget.showSubtitleBtn ?? true)
|
if (widget.showSubtitleBtn)
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.closed_caption_off,
|
Icons.closed_caption_off,
|
||||||
|
|||||||
@ -929,6 +929,11 @@ class PlPlayerController {
|
|||||||
showControls.value = !val;
|
showControls.value = !val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 设置/更新顶部控制栏
|
||||||
|
void setHeaderControl(PreferredSizeWidget? widget) {
|
||||||
|
headerControl = widget;
|
||||||
|
}
|
||||||
|
|
||||||
void toggleFullScreen(bool val) {
|
void toggleFullScreen(bool val) {
|
||||||
_isFullScreen.value = val;
|
_isFullScreen.value = val;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user