mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 退出全屏逻辑优化
This commit is contained in:
@@ -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<VideoDetailPage>
|
||||
videoPlayerServiceHandler.onVideoDetailDispose();
|
||||
floating.dispose();
|
||||
_lifecycleListener.dispose();
|
||||
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||
exitFullScreen();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -838,6 +840,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
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(
|
||||
|
||||
@@ -948,15 +948,15 @@ class PlPlayerController {
|
||||
|
||||
// 全屏
|
||||
Future<void> 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) {
|
||||
|
||||
@@ -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<void> landScape() async {
|
||||
dynamic document;
|
||||
@@ -74,7 +77,11 @@ Future<void> 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(
|
||||
|
||||
Reference in New Issue
Block a user