mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 未开启横屏时不转屏
This commit is contained in:
@@ -28,57 +28,65 @@ import './services/loggeer.dart';
|
|||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
MediaKit.ensureInitialized();
|
MediaKit.ensureInitialized();
|
||||||
SystemChrome.setPreferredOrientations(
|
await GStrorage.init();
|
||||||
//支持竖屏与横屏
|
if (GStrorage.setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
[
|
await SystemChrome.setPreferredOrientations(
|
||||||
DeviceOrientation.portraitUp,
|
//支持竖屏与横屏
|
||||||
DeviceOrientation.portraitDown,
|
|
||||||
DeviceOrientation.landscapeLeft,
|
|
||||||
DeviceOrientation.landscapeRight,
|
|
||||||
],
|
|
||||||
).then((_) async {
|
|
||||||
await GStrorage.init();
|
|
||||||
await setupServiceLocator();
|
|
||||||
Request();
|
|
||||||
await Request.setCookie();
|
|
||||||
RecommendFilter();
|
|
||||||
|
|
||||||
// 异常捕获 logo记录
|
|
||||||
final Catcher2Options debugConfig = Catcher2Options(
|
|
||||||
SilentReportMode(),
|
|
||||||
[
|
[
|
||||||
FileHandler(await getLogsPath()),
|
DeviceOrientation.portraitUp,
|
||||||
ConsoleHandler(
|
DeviceOrientation.portraitDown,
|
||||||
enableDeviceParameters: false,
|
DeviceOrientation.landscapeLeft,
|
||||||
enableApplicationParameters: false,
|
DeviceOrientation.landscapeRight,
|
||||||
)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
final Catcher2Options releaseConfig = Catcher2Options(
|
await SystemChrome.setPreferredOrientations(
|
||||||
SilentReportMode(),
|
//支持竖屏
|
||||||
[FileHandler(await getLogsPath())],
|
[
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
await setupServiceLocator();
|
||||||
|
Request();
|
||||||
|
await Request.setCookie();
|
||||||
|
RecommendFilter();
|
||||||
|
|
||||||
Catcher2(
|
// 异常捕获 logo记录
|
||||||
debugConfig: debugConfig,
|
final Catcher2Options debugConfig = Catcher2Options(
|
||||||
releaseConfig: releaseConfig,
|
SilentReportMode(),
|
||||||
runAppFunction: () {
|
[
|
||||||
runApp(const MyApp());
|
FileHandler(await getLogsPath()),
|
||||||
},
|
ConsoleHandler(
|
||||||
);
|
enableDeviceParameters: false,
|
||||||
|
enableApplicationParameters: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
final Catcher2Options releaseConfig = Catcher2Options(
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
SilentReportMode(),
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
[FileHandler(await getLogsPath())],
|
||||||
systemNavigationBarColor: Colors.transparent,
|
);
|
||||||
systemNavigationBarDividerColor: Colors.transparent,
|
|
||||||
statusBarColor: Colors.transparent,
|
Catcher2(
|
||||||
));
|
debugConfig: debugConfig,
|
||||||
Data.init();
|
releaseConfig: releaseConfig,
|
||||||
GStrorage.lazyInit();
|
runAppFunction: () {
|
||||||
PiliSchame.init();
|
runApp(const MyApp());
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// 小白条、导航栏沉浸
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor: Colors.transparent,
|
||||||
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
|
statusBarColor: Colors.transparent,
|
||||||
|
));
|
||||||
|
Data.init();
|
||||||
|
GStrorage.lazyInit();
|
||||||
|
PiliSchame.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:auto_orientation/auto_orientation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
@@ -116,11 +118,20 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
setKey: SettingBoxKey.enableAutoExit,
|
setKey: SettingBoxKey.enableAutoExit,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
SetSwitchItem(
|
||||||
title: '横屏适配(测试)',
|
title: '横屏适配(测试)',
|
||||||
subTitle: '开启该项在播放页启用横屏布局与逻辑',
|
subTitle: '开启该项在播放页启用横屏布局与逻辑',
|
||||||
setKey: SettingBoxKey.horizontalScreen,
|
setKey: SettingBoxKey.horizontalScreen,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
|
callFn: (value) {
|
||||||
|
if (value) {
|
||||||
|
autoScreen();
|
||||||
|
SmartDialog.showToast('已开启横屏适配');
|
||||||
|
} else {
|
||||||
|
AutoOrientation.portraitUpMode();
|
||||||
|
SmartDialog.showToast('已关闭横屏适配');
|
||||||
|
}
|
||||||
|
}
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '开启硬解',
|
title: '开启硬解',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:auto_orientation/auto_orientation.dart';
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||||
import 'package:floating/floating.dart';
|
import 'package:floating/floating.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@@ -198,6 +199,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
if (!horizontalScreen) {
|
||||||
|
AutoOrientation.portraitUpMode();
|
||||||
|
}
|
||||||
shutdownTimerService.handleWaitingFinished();
|
shutdownTimerService.handleWaitingFinished();
|
||||||
if (plPlayerController != null) {
|
if (plPlayerController != null) {
|
||||||
plPlayerController!.removeStatusLister(playerListener);
|
plPlayerController!.removeStatusLister(playerListener);
|
||||||
|
|||||||
@@ -42,6 +42,16 @@ Future<void> verticalScreen() async {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//全向
|
||||||
|
Future<void> autoScreen() async {
|
||||||
|
await SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown,
|
||||||
|
DeviceOrientation.landscapeLeft,
|
||||||
|
DeviceOrientation.landscapeRight,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> enterFullScreen() async {
|
Future<void> enterFullScreen() async {
|
||||||
await SystemChrome.setEnabledSystemUIMode(
|
await SystemChrome.setEnabledSystemUIMode(
|
||||||
SystemUiMode.immersiveSticky,
|
SystemUiMode.immersiveSticky,
|
||||||
|
|||||||
Reference in New Issue
Block a user