From 9d684d19769d9b74c4e1e1fa2daf00b7a0d2e26f Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 7 Mar 2024 09:13:29 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E7=AB=96=E5=B1=8F=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=8F=AA=E6=8C=81=E7=BB=AD=E4=B8=A4=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/live_room/view.dart | 2 +- lib/pages/video/detail/view.dart | 22 +++++++++---------- .../video/detail/widgets/header_control.dart | 2 +- lib/plugin/pl_player/controller.dart | 11 +++++----- lib/plugin/pl_player/utils/fullscreen.dart | 10 +++++++++ 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 3b988330..820c9f6b 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -181,7 +181,7 @@ class _LiveRoomPageState extends State { } if (MediaQuery.of(context).orientation == Orientation.landscape) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: SizedBox( diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 2a83061e..bbc41b4a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -200,20 +200,20 @@ class _VideoDetailPageState extends State plPlayerController!.isFullScreen.listen((bool status) { if (status) { videoDetailController.hiddenReplyReplyPanel(); - hideStatusBar(); + // hideStatusBar(); } isFullScreen.value = status; if (mounted) { setState(() {}); } - if (!status) { - showStatusBar(); - if (horizontalScreen) { - autoScreen(); - } else { - verticalScreen(); - } - } + // if (!status) { + // showStatusBar(); + // if (horizontalScreen) { + // autoScreen(); + // } else { + // verticalScreenForTwoSeconds(); + // } + // } }); } @@ -371,7 +371,7 @@ class _VideoDetailPageState extends State if (MediaQuery.of(context).orientation == Orientation.landscape && !horizontalScreen) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: Stack( @@ -623,7 +623,7 @@ class _VideoDetailPageState extends State if (MediaQuery.of(context).orientation == Orientation.landscape && !horizontalScreen) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: Stack( diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 3b29c74e..f5d78caf 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1052,7 +1052,7 @@ class _HeaderControlState extends State { Orientation.landscape && !horizontalScreen) { - verticalScreen(), + verticalScreenForTwoSeconds(), }, Get.back() } diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 4a177342..090ab2a9 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -992,6 +992,8 @@ class PlPlayerController { // 全屏 Future triggerFullScreen({bool status = true}) async { + FullScreenMode mode = FullScreenModeCode.fromCode( + setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; if (!isFullScreen.value && status) { // StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE); hideStatusBar(); @@ -1000,8 +1002,6 @@ class PlPlayerController { toggleFullScreen(true); /// 进入全屏 - FullScreenMode mode = FullScreenModeCode.fromCode( - setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; if (mode == FullScreenMode.none) { return; } @@ -1010,7 +1010,7 @@ class PlPlayerController { (mode == FullScreenMode.ratio && (Get.height / Get.width < 1.25 || direction.value == 'vertical'))) { - await verticalScreen(); + await verticalScreenForTwoSeconds(); } else { await landScape(); } @@ -1018,8 +1018,9 @@ class PlPlayerController { // StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); showStatusBar(); toggleFullScreen(false); - if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) { - await verticalScreen(); + if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false) && + mode != FullScreenMode.none) { + await verticalScreenForTwoSeconds(); } } } diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index aa7e4768..7f354c49 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -25,6 +25,16 @@ Future landScape() async { } } +//竖屏 +Future verticalScreenForTwoSeconds() async { + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + ]); + Future.delayed(const Duration(seconds: 2), () { + autoScreen(); + }); +} + //竖屏 Future verticalScreen() async { await SystemChrome.setPreferredOrientations([