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/plugin/pl_player/models/play_repeat.dart';
|
||||||
import 'package:PiliPalaX/services/service_locator.dart';
|
import 'package:PiliPalaX/services/service_locator.dart';
|
||||||
import 'package:PiliPalaX/utils/storage.dart';
|
import 'package:PiliPalaX/utils/storage.dart';
|
||||||
|
import 'package:status_bar_control/status_bar_control.dart';
|
||||||
|
|
||||||
import '../../../services/shutdown_timer_service.dart';
|
import '../../../services/shutdown_timer_service.dart';
|
||||||
import 'widgets/header_control.dart';
|
import 'widgets/header_control.dart';
|
||||||
@@ -202,6 +203,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoPlayerServiceHandler.onVideoDetailDispose();
|
videoPlayerServiceHandler.onVideoDetailDispose();
|
||||||
floating.dispose();
|
floating.dispose();
|
||||||
_lifecycleListener.dispose();
|
_lifecycleListener.dispose();
|
||||||
|
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@@ -838,6 +840,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
builder: (BuildContext context, Orientation orientation) {
|
builder: (BuildContext context, Orientation orientation) {
|
||||||
if (orientation == Orientation.landscape) {
|
if (orientation == Orientation.landscape) {
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
|
} else if (!isFullScreen.value) {
|
||||||
|
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
return PiPSwitcher(
|
return PiPSwitcher(
|
||||||
|
|||||||
@@ -948,15 +948,15 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 全屏
|
// 全屏
|
||||||
Future<void> triggerFullScreen({bool status = true}) async {
|
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) {
|
if (!isFullScreen.value && status) {
|
||||||
|
await StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
|
||||||
/// 按照视频宽高比决定全屏方向
|
/// 按照视频宽高比决定全屏方向
|
||||||
toggleFullScreen(true);
|
toggleFullScreen(true);
|
||||||
|
|
||||||
/// 进入全屏
|
/// 进入全屏
|
||||||
await enterFullScreen();
|
await enterFullScreen();
|
||||||
|
FullScreenMode mode = FullScreenModeCode.fromCode(
|
||||||
|
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
||||||
if (mode == FullScreenMode.vertical ||
|
if (mode == FullScreenMode.vertical ||
|
||||||
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
||||||
(mode == FullScreenMode.ratio &&
|
(mode == FullScreenMode.ratio &&
|
||||||
@@ -999,12 +999,12 @@ class PlPlayerController {
|
|||||||
// toggleFullScreen(false);
|
// toggleFullScreen(false);
|
||||||
// }
|
// }
|
||||||
} else if (isFullScreen.value) {
|
} else if (isFullScreen.value) {
|
||||||
|
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||||
// Get.back();
|
// Get.back();
|
||||||
exitFullScreen();
|
// await verticalScreen();
|
||||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
|
||||||
await verticalScreen();
|
|
||||||
}
|
}
|
||||||
|
exitFullScreen();
|
||||||
toggleFullScreen(false);
|
toggleFullScreen(false);
|
||||||
}
|
}
|
||||||
if (triggerFullscreenCallback != null) {
|
if (triggerFullscreenCallback != null) {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import 'package:auto_orientation/auto_orientation.dart';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import '../../../common/widgets/custom_toast.dart';
|
||||||
|
import '../../../utils/storage.dart';
|
||||||
|
|
||||||
//横屏
|
//横屏
|
||||||
Future<void> landScape() async {
|
Future<void> landScape() async {
|
||||||
dynamic document;
|
dynamic document;
|
||||||
@@ -74,7 +77,11 @@ Future<void> exitFullScreen() async {
|
|||||||
mode,
|
mode,
|
||||||
overlays: SystemUiOverlay.values,
|
overlays: SystemUiOverlay.values,
|
||||||
);
|
);
|
||||||
await SystemChrome.setPreferredOrientations([]);
|
if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
|
autoScreen();
|
||||||
|
} else {
|
||||||
|
verticalScreen();
|
||||||
|
}
|
||||||
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
||||||
await const MethodChannel('com.alexmercerind/media_kit_video')
|
await const MethodChannel('com.alexmercerind/media_kit_video')
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
|
|||||||
Reference in New Issue
Block a user