From 87c2ffe169361aad525da9ef92f3239666bc66d2 Mon Sep 17 00:00:00 2001 From: orz12 Date: Thu, 22 Feb 2024 17:08:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=80=E5=87=BA=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 4 ++++ lib/plugin/pl_player/controller.dart | 14 +++++++------- lib/plugin/pl_player/utils/fullscreen.dart | 9 ++++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index fcc893223..56a24a47d 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -23,6 +23,7 @@ import 'package:PiliPalaX/plugin/pl_player/index.dart'; import 'package:PiliPalaX/plugin/pl_player/models/play_repeat.dart'; import 'package:PiliPalaX/services/service_locator.dart'; import 'package:PiliPalaX/utils/storage.dart'; +import 'package:status_bar_control/status_bar_control.dart'; import '../../../services/shutdown_timer_service.dart'; import 'widgets/header_control.dart'; @@ -202,6 +203,7 @@ class _VideoDetailPageState extends State videoPlayerServiceHandler.onVideoDetailDispose(); floating.dispose(); _lifecycleListener.dispose(); + StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); exitFullScreen(); super.dispose(); } @@ -838,6 +840,8 @@ class _VideoDetailPageState extends State builder: (BuildContext context, Orientation orientation) { if (orientation == Orientation.landscape) { enterFullScreen(); + } else if (!isFullScreen.value) { + StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); } if (Platform.isAndroid) { return PiPSwitcher( diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index f8f160055..7ebfd0aec 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -948,15 +948,15 @@ class PlPlayerController { // 全屏 Future triggerFullScreen({bool status = true}) async { - FullScreenMode mode = FullScreenModeCode.fromCode( - setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; - await StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE); if (!isFullScreen.value && status) { + await StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE); /// 按照视频宽高比决定全屏方向 toggleFullScreen(true); /// 进入全屏 await enterFullScreen(); + FullScreenMode mode = FullScreenModeCode.fromCode( + setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; if (mode == FullScreenMode.vertical || (mode == FullScreenMode.auto && direction.value == 'vertical') || (mode == FullScreenMode.ratio && @@ -999,12 +999,12 @@ class PlPlayerController { // toggleFullScreen(false); // } } else if (isFullScreen.value) { - StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); - // Get.back(); - exitFullScreen(); if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) { - await verticalScreen(); + StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); + // Get.back(); + // await verticalScreen(); } + exitFullScreen(); toggleFullScreen(false); } if (triggerFullscreenCallback != null) { diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index c5036282d..e89a19c67 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -5,6 +5,9 @@ import 'package:auto_orientation/auto_orientation.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import '../../../common/widgets/custom_toast.dart'; +import '../../../utils/storage.dart'; + //横屏 Future landScape() async { dynamic document; @@ -74,7 +77,11 @@ Future exitFullScreen() async { mode, overlays: SystemUiOverlay.values, ); - await SystemChrome.setPreferredOrientations([]); + 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(