mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-19 19:01:24 +08:00
bring back remove player safearea
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -30,6 +30,7 @@ import 'package:PiliPlus/pages/video/widgets/player_focus.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/view/view.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
@@ -81,12 +82,19 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
plPlayerController = _liveRoomController.plPlayerController
|
||||
..addStatusLister(playerListener);
|
||||
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
||||
if (plPlayerController.removeSafeArea) {
|
||||
hideStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
padding = MediaQuery.viewPaddingOf(context);
|
||||
if (plPlayerController.removeSafeArea) {
|
||||
padding = .zero;
|
||||
} else {
|
||||
padding = MediaQuery.viewPaddingOf(context);
|
||||
}
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
maxWidth = size.width;
|
||||
maxHeight = size.height;
|
||||
@@ -391,6 +399,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
},
|
||||
),
|
||||
Scaffold(
|
||||
primary: !plPlayerController.removeSafeArea,
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: isFullScreen && !isPortrait
|
||||
@@ -486,6 +495,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
PreferredSizeWidget _buildAppBar(bool isFullScreen) {
|
||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
return AppBar(
|
||||
primary: !plPlayerController.removeSafeArea,
|
||||
toolbarHeight: isFullScreen ? 0 : null,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
|
||||
@@ -136,6 +136,12 @@ List<SettingsModel> get styleSettings => [
|
||||
'当前: 主页${Pref.recommendCardWidth.toInt()}dp 其他${Pref.smallCardWidth.toInt()}dp,屏幕宽度:${MediaQuery.widthOf(Get.context!).toPrecision(2)}dp。宽度越小列数越多。',
|
||||
onTap: _showCardWidthDialog,
|
||||
),
|
||||
const SwitchModel(
|
||||
title: '播放页移除安全边距',
|
||||
leading: Icon(Icons.fit_screen_outlined),
|
||||
setKey: SettingBoxKey.removeSafeArea,
|
||||
defaultVal: false,
|
||||
),
|
||||
SwitchModel(
|
||||
title: '视频播放页使用深色主题',
|
||||
leading: const Icon(Icons.dark_mode_outlined),
|
||||
|
||||
@@ -124,6 +124,7 @@ class VideoDetailController extends GetxController
|
||||
final plPlayerController = PlPlayerController.getInstance()
|
||||
..brightness.value = -1;
|
||||
bool get setSystemBrightness => plPlayerController.setSystemBrightness;
|
||||
bool get removeSafeArea => plPlayerController.removeSafeArea;
|
||||
|
||||
late VideoItem firstVideo;
|
||||
String? videoUrl;
|
||||
|
||||
@@ -59,7 +59,6 @@ import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/mobile_observer.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
@@ -142,6 +141,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
PlPlayerController.setPlayCallBack(playCallBack);
|
||||
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
||||
|
||||
if (videoDetailController.removeSafeArea) {
|
||||
hideStatusBar();
|
||||
}
|
||||
|
||||
if (videoDetailController.showReply) {
|
||||
_videoReplyController = Get.put(
|
||||
VideoReplyController(
|
||||
@@ -347,6 +350,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
}
|
||||
|
||||
if (!videoDetailController.removeSafeArea) {
|
||||
showStatusBar();
|
||||
}
|
||||
|
||||
if (!videoDetailController.plPlayerController.isCloseAll) {
|
||||
videoPlayerServiceHandler?.onVideoDetailDispose(heroTag);
|
||||
if (plPlayerController != null) {
|
||||
@@ -357,9 +364,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
}
|
||||
removeObserverMobile(this);
|
||||
if (PlatformUtils.isMobile) {
|
||||
showStatusBar();
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -449,7 +454,11 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
padding = MediaQuery.viewPaddingOf(context);
|
||||
if (videoDetailController.removeSafeArea) {
|
||||
padding = .zero;
|
||||
} else {
|
||||
padding = MediaQuery.viewPaddingOf(context);
|
||||
}
|
||||
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
maxWidth = size.width;
|
||||
@@ -507,6 +516,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
}
|
||||
|
||||
bool get removeAppBar =>
|
||||
videoDetailController.removeSafeArea || (isFullScreen && !isPortrait);
|
||||
|
||||
Widget get childWhenDisabled {
|
||||
videoDetailController.animationController
|
||||
..removeListener(animListener)
|
||||
@@ -516,7 +528,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: isFullScreen && !isPortrait
|
||||
appBar: removeAppBar
|
||||
? null
|
||||
: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(0),
|
||||
@@ -818,7 +830,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: isFullScreen && !isPortrait
|
||||
appBar: removeAppBar
|
||||
? null
|
||||
: AppBar(backgroundColor: Colors.black, toolbarHeight: 0),
|
||||
body: Padding(
|
||||
@@ -1048,7 +1060,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: isFullScreen && !isPortrait
|
||||
appBar: removeAppBar
|
||||
? null
|
||||
: AppBar(backgroundColor: Colors.black, toolbarHeight: 0),
|
||||
body: Padding(
|
||||
|
||||
@@ -1881,7 +1881,7 @@ class HeaderControlState extends State<HeaderControl>
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
if (isFullScreen || PlatformUtils.isDesktop) ...[
|
||||
if (!isPortrait || isFullScreen || PlatformUtils.isDesktop) ...[
|
||||
SizedBox(
|
||||
width: btnWidth,
|
||||
height: btnHeight,
|
||||
|
||||
@@ -1424,6 +1424,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
bool isManualFS = true;
|
||||
late final FullScreenMode mode = Pref.fullScreenMode;
|
||||
late final horizontalScreen = Pref.horizontalScreen;
|
||||
late final removeSafeArea = Pref.removeSafeArea;
|
||||
|
||||
// 全屏
|
||||
bool _fsProcessing = false;
|
||||
@@ -1475,12 +1476,26 @@ class PlPlayerController with BlockConfigMixin {
|
||||
}
|
||||
} else {
|
||||
if (PlatformUtils.isMobile) {
|
||||
showStatusBar();
|
||||
if (!removeSafeArea) {
|
||||
showStatusBar();
|
||||
}
|
||||
if (orientation == null && mode == .none) {
|
||||
return;
|
||||
}
|
||||
if (!horizontalScreen) {
|
||||
await portraitUpMode();
|
||||
} else {
|
||||
switch (_orientation) {
|
||||
case .portraitUp:
|
||||
await portraitUpMode();
|
||||
case .landscapeLeft:
|
||||
await landscapeLeftMode();
|
||||
case .portraitDown:
|
||||
await portraitDownMode();
|
||||
case .landscapeRight:
|
||||
await landscapeRightMode();
|
||||
case _:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await exitDesktopFullScreen();
|
||||
@@ -1617,6 +1632,9 @@ class PlPlayerController with BlockConfigMixin {
|
||||
}
|
||||
|
||||
_playerCount = 0;
|
||||
if (removeSafeArea) {
|
||||
showStatusBar();
|
||||
}
|
||||
danmakuController = null;
|
||||
_stopOrientationListener();
|
||||
_disableAutoEnterPip();
|
||||
|
||||
@@ -1616,6 +1616,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
isTop: true,
|
||||
controller: animationController,
|
||||
isFullScreen: isFullScreen,
|
||||
removeSafeArea: plPlayerController.removeSafeArea,
|
||||
child: plPlayerController.isDesktopPip
|
||||
? GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
@@ -1628,6 +1629,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
isTop: false,
|
||||
controller: animationController,
|
||||
isFullScreen: isFullScreen,
|
||||
removeSafeArea: plPlayerController.removeSafeArea,
|
||||
child:
|
||||
widget.bottomControl ??
|
||||
BottomControl(
|
||||
@@ -1816,6 +1818,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (plPlayerController.showFsLockBtn)
|
||||
ViewSafeArea(
|
||||
right: false,
|
||||
left: !plPlayerController.removeSafeArea,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FractionalTranslation(
|
||||
@@ -1859,6 +1862,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (plPlayerController.showFsScreenshotBtn)
|
||||
ViewSafeArea(
|
||||
left: false,
|
||||
right: !plPlayerController.removeSafeArea,
|
||||
child: Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.centerRight,
|
||||
|
||||
@@ -8,12 +8,14 @@ class AppBarAni extends StatelessWidget {
|
||||
required this.controller,
|
||||
required this.isTop,
|
||||
required this.isFullScreen,
|
||||
required this.removeSafeArea,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final AnimationController controller;
|
||||
final bool isTop;
|
||||
final bool isFullScreen;
|
||||
final bool removeSafeArea;
|
||||
|
||||
static final _topPos = Tween<Offset>(
|
||||
begin: const Offset(0.0, -1.0),
|
||||
@@ -53,11 +55,13 @@ class AppBarAni extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
gradient: isTop ? _topDecoration : _bottomDecoration,
|
||||
),
|
||||
child: ViewSafeArea(
|
||||
left: isFullScreen,
|
||||
right: isFullScreen,
|
||||
child: child,
|
||||
),
|
||||
child: removeSafeArea
|
||||
? child
|
||||
: ViewSafeArea(
|
||||
left: isFullScreen,
|
||||
right: isFullScreen,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,8 @@ abstract final class SettingBoxKey {
|
||||
enableImgMenu = 'enableImgMenu',
|
||||
showDynDispute = 'showDynDispute',
|
||||
touchSlopH = 'touchSlopH',
|
||||
floatingNavBar = 'floatingNavBar';
|
||||
floatingNavBar = 'floatingNavBar',
|
||||
removeSafeArea = 'removeSafeArea';
|
||||
|
||||
static const String minimizeOnExit = 'minimizeOnExit',
|
||||
windowSize = 'windowSize',
|
||||
|
||||
@@ -970,4 +970,7 @@ abstract final class Pref {
|
||||
|
||||
static bool get floatingNavBar =>
|
||||
_setting.get(SettingBoxKey.floatingNavBar, defaultValue: false);
|
||||
|
||||
static bool get removeSafeArea =>
|
||||
_setting.get(SettingBoxKey.removeSafeArea, defaultValue: false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user