From ba5d99008a8bd7024a3dd5b08964f3e3cf16e7d8 Mon Sep 17 00:00:00 2001 From: orz12 Date: Fri, 23 Feb 2024 17:27:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E7=A7=BB=E9=99=A4Obx=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E5=B1=8F=E4=B8=8E=E9=80=80=E5=87=BA=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91=EF=BC=8C=E7=BB=9F=E4=B8=80=E8=87=B3?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E5=99=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 55 ++++++++++++---------- lib/plugin/pl_player/utils/fullscreen.dart | 5 -- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 70dac19a1..7f3b65b67 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -96,6 +96,7 @@ class _VideoDetailPageState extends State appbarStreamListen(); lifecycleListener(); fullScreenStatusListener(); + autoScreen(); } // 获取视频资源,初始化播放器 @@ -188,10 +189,19 @@ class _VideoDetailPageState extends State plPlayerController?.isFullScreen.listen((bool isFullScreen) { if (isFullScreen) { videoDetailController.hiddenReplyReplyPanel(); + enterFullScreen(); } setState(() { this.isFullScreen.value = isFullScreen; }); + if (!isFullScreen) { + exitFullScreen(); + if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) { + autoScreen(); + } else { + verticalScreen(); + } + } }); } @@ -290,7 +300,6 @@ class _VideoDetailPageState extends State } } - @override Widget build(BuildContext context) { Widget childWhenDisabled = SafeArea( @@ -317,13 +326,6 @@ class _VideoDetailPageState extends State children: [ Obx( () { - if (MediaQuery.of(context).orientation == - Orientation.landscape || - isFullScreen.value == true) { - enterFullScreen(); - } else { - exitFullScreen(); - } final double videoheight = Get.width * 9 / 16; final double videowidth = Get.width; return SizedBox( @@ -547,7 +549,7 @@ class _VideoDetailPageState extends State }, ), Obx( - () => VideoReplyPanel( + () => VideoReplyPanel( bvid: videoDetailController.bvid, oid: videoDetailController.oid.value, ), @@ -826,34 +828,39 @@ class _VideoDetailPageState extends State } }, ); - if (!horizontalScreen) { - if (Platform.isAndroid) { - return PiPSwitcher( - childWhenEnabled: childWhenEnabled, - childWhenDisabled: childWhenDisabled, - floating: floating,); - } - return childWhenDisabled; - } + // if (!horizontalScreen) { + // if (Platform.isAndroid) { + // return PiPSwitcher( + // childWhenEnabled: childWhenEnabled, + // childWhenDisabled: childWhenDisabled, + // floating: floating,); + // } + // return childWhenDisabled; + // } return OrientationBuilder( builder: (BuildContext context, Orientation orientation) { + print("orientation $orientation"); if (orientation == Orientation.landscape) { enterFullScreen(); + if (!horizontalScreen) { + videoDetailController.hiddenReplyReplyPanel(); + } } else if (!isFullScreen.value) { StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); } if (Platform.isAndroid) { return PiPSwitcher( - childWhenDisabled: orientation == Orientation.portrait - ? childWhenDisabled - : childWhenDisabledLandscape, + childWhenDisabled: + !horizontalScreen || orientation == Orientation.portrait + ? childWhenDisabled + : childWhenDisabledLandscape, childWhenEnabled: childWhenEnabled, floating: floating, ); } - return orientation == Orientation.portrait - ? childWhenDisabled - : childWhenDisabledLandscape; + return !horizontalScreen || orientation == Orientation.portrait + ? childWhenDisabled + : childWhenDisabledLandscape; }); } } diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index e2f8c8102..cafda3279 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -75,11 +75,6 @@ Future exitFullScreen() async { mode, overlays: SystemUiOverlay.values, ); - if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) { - autoScreen(); - } else { - verticalScreen(); - } } else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) { await const MethodChannel('com.alexmercerind/media_kit_video') .invokeMethod(