fix: full screen video title

This commit is contained in:
bggRGjQaUbCoE
2024-10-08 20:45:32 +08:00
parent 659c7363d5
commit deed476249
2 changed files with 23 additions and 20 deletions

View File

@@ -898,8 +898,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
? null ? null
: Obx( : Obx(
() => PlDanmaku( () => PlDanmaku(
key: Key(videoDetailController.danmakuCid.value // key: Key(videoDetailController.danmakuCid.value
.toString()), // .toString()),
cid: videoDetailController.danmakuCid.value, cid: videoDetailController.danmakuCid.value,
playerController: plPlayerController!, playerController: plPlayerController!,
), ),
@@ -998,8 +998,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
headerControl: videoDetailController.headerControl, headerControl: videoDetailController.headerControl,
danmuWidget: Obx( danmuWidget: Obx(
() => PlDanmaku( () => PlDanmaku(
key: Key(videoDetailController.danmakuCid.value // key: Key(videoDetailController.danmakuCid.value
.toString()), // .toString()),
cid: videoDetailController.danmakuCid.value, cid: videoDetailController.danmakuCid.value,
playerController: plPlayerController!, playerController: plPlayerController!,
), ),

View File

@@ -56,21 +56,23 @@ class _HeaderControlState extends State<HeaderControl> {
final Box<dynamic> localCache = GStorage.localCache; final Box<dynamic> localCache = GStorage.localCache;
final Box<dynamic> videoStorage = GStorage.video; final Box<dynamic> videoStorage = GStorage.video;
double buttonSpace = 8; double buttonSpace = 8;
bool isFullScreen = false; // bool isFullScreen = false;
late String heroTag; late String heroTag;
late VideoIntroController videoIntroController; late VideoIntroController videoIntroController;
late VideoDetailData videoDetail; late VideoDetailData videoDetail;
late StreamSubscription<bool> fullScreenStatusListener; // late StreamSubscription<bool> fullScreenStatusListener;
late bool horizontalScreen; late bool horizontalScreen;
RxString now = ''.obs; RxString now = ''.obs;
late Timer clock; late Timer clock;
late String defaultCDNService; late String defaultCDNService;
bool get isFullScreen => widget.controller!.isFullScreen.value;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
videoInfo = widget.videoDetailCtr!.data; videoInfo = widget.videoDetailCtr!.data;
listenFullScreenStatus(); // listenFullScreenStatus();
heroTag = widget.heroTag; heroTag = widget.heroTag;
// if (Get.arguments != null && Get.arguments['heroTag'] != null) { // if (Get.arguments != null && Get.arguments['heroTag'] != null) {
// heroTag = Get.arguments['heroTag']; // heroTag = Get.arguments['heroTag'];
@@ -83,23 +85,23 @@ class _HeaderControlState extends State<HeaderControl> {
startClock(); startClock();
} }
void listenFullScreenStatus() { // void listenFullScreenStatus() {
fullScreenStatusListener = widget // fullScreenStatusListener = widget
.videoDetailCtr!.plPlayerController.isFullScreen // .videoDetailCtr!.plPlayerController.isFullScreen
.listen((bool status) { // .listen((bool status) {
isFullScreen = status; // isFullScreen = status;
/// TODO setState() called after dispose() // /// TODO setState() called after dispose()
if (mounted) { // if (mounted) {
setState(() {}); // setState(() {});
} // }
}); // });
} // }
@override @override
void dispose() { void dispose() {
widget.floating?.dispose(); widget.floating?.dispose();
fullScreenStatusListener.cancel(); // fullScreenStatusListener.cancel();
clock.cancel(); clock.cancel();
super.dispose(); super.dispose();
} }
@@ -1318,6 +1320,7 @@ class _HeaderControlState extends State<HeaderControl> {
final _ = widget.controller!; final _ = widget.controller!;
// final bool isLandscape = // final bool isLandscape =
// MediaQuery.of(context).orientation == Orientation.landscape; // MediaQuery.of(context).orientation == Orientation.landscape;
bool equivalentFullScreen = !isFullScreen && bool equivalentFullScreen = !isFullScreen &&
!horizontalScreen && !horizontalScreen &&
MediaQuery.of(context).orientation == Orientation.landscape; MediaQuery.of(context).orientation == Orientation.landscape;
@@ -1344,7 +1347,7 @@ class _HeaderControlState extends State<HeaderControl> {
color: Colors.white, color: Colors.white,
), ),
onPressed: () { onPressed: () {
if (widget.controller!.isFullScreen.value) { if (isFullScreen) {
widget.controller!.triggerFullScreen(status: false); widget.controller!.triggerFullScreen(status: false);
} else if (MediaQuery.of(context).orientation == } else if (MediaQuery.of(context).orientation ==
Orientation.landscape && Orientation.landscape &&