mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-18 09:36:52 +08:00
@@ -25,10 +25,13 @@ import 'package:PiliPlus/common/widgets/image_viewer/image.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/image_viewer/loading_indicator.dart';
|
import 'package:PiliPlus/common/widgets/image_viewer/loading_indicator.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image_viewer/viewer.dart';
|
import 'package:PiliPlus/common/widgets/image_viewer/viewer.dart';
|
||||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||||
|
import 'package:PiliPlus/main.dart' show tmpPadding;
|
||||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||||
|
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||||
import 'package:PiliPlus/utils/image_utils.dart';
|
import 'package:PiliPlus/utils/image_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/max_screen_size.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||||
@@ -76,6 +79,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
late final int _quality;
|
late final int _quality;
|
||||||
late final RxInt _currIndex;
|
late final RxInt _currIndex;
|
||||||
GlobalKey? _key;
|
GlobalKey? _key;
|
||||||
|
EdgeInsets? _padding;
|
||||||
|
|
||||||
late bool _hasInit = false;
|
late bool _hasInit = false;
|
||||||
Player? _player;
|
Player? _player;
|
||||||
@@ -170,6 +174,45 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late final bool _hideSystemBar;
|
||||||
|
|
||||||
|
void _initHideSystemBar() {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
if (showSystemBar_) {
|
||||||
|
final view = WidgetsBinding.instance.platformDispatcher.views.first;
|
||||||
|
final size = view.physicalSize / view.devicePixelRatio;
|
||||||
|
_hideSystemBar = !MaxScreenSize.isWindowMode(
|
||||||
|
width: size.width,
|
||||||
|
height: size.height,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
_hideSystemBar = false;
|
||||||
|
}
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
_hideSystemBar = showSystemBar_;
|
||||||
|
} else {
|
||||||
|
_hideSystemBar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
if (_padding == null) {
|
||||||
|
final padding = MediaQuery.viewPaddingOf(context);
|
||||||
|
_padding = padding;
|
||||||
|
_initHideSystemBar();
|
||||||
|
if (_hideSystemBar) {
|
||||||
|
tmpPadding = padding;
|
||||||
|
hideSystemBar()!.whenComplete(
|
||||||
|
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => tmpPadding = null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Matrix4 _onTransform(double val) {
|
Matrix4 _onTransform(double val) {
|
||||||
final scale = val.lerp(1.0, 0.25);
|
final scale = val.lerp(1.0, 0.25);
|
||||||
|
|
||||||
@@ -259,6 +302,9 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
}
|
}
|
||||||
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
if (_hideSystemBar) {
|
||||||
|
showSystemBar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPointerDown(PointerDownEvent event) {
|
void _onPointerDown(PointerDownEvent event) {
|
||||||
@@ -311,9 +357,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:
|
padding: _padding! + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||||
MediaQuery.viewPaddingOf(context) +
|
|
||||||
const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ import 'package:window_manager/window_manager.dart' hide calcWindowPosition;
|
|||||||
|
|
||||||
WebViewEnvironment? webViewEnvironment;
|
WebViewEnvironment? webViewEnvironment;
|
||||||
|
|
||||||
|
EdgeInsets? tmpPadding;
|
||||||
|
|
||||||
Future<void> _initDownPath() async {
|
Future<void> _initDownPath() async {
|
||||||
if (PlatformUtils.isDesktop) {
|
if (PlatformUtils.isDesktop) {
|
||||||
final customDownPath = Pref.downloadPath;
|
final customDownPath = Pref.downloadPath;
|
||||||
@@ -317,16 +319,20 @@ class MyApp extends StatelessWidget {
|
|||||||
data: mediaQuery.copyWith(
|
data: mediaQuery.copyWith(
|
||||||
textScaler: textScaler,
|
textScaler: textScaler,
|
||||||
size: mediaQuery.size / uiScale,
|
size: mediaQuery.size / uiScale,
|
||||||
padding: mediaQuery.padding / uiScale,
|
padding: (tmpPadding ?? mediaQuery.padding) / uiScale,
|
||||||
viewInsets: mediaQuery.viewInsets / uiScale,
|
viewInsets: mediaQuery.viewInsets / uiScale,
|
||||||
viewPadding: mediaQuery.viewPadding / uiScale,
|
viewPadding: (tmpPadding ?? mediaQuery.viewPadding) / uiScale,
|
||||||
devicePixelRatio: mediaQuery.devicePixelRatio * uiScale,
|
devicePixelRatio: mediaQuery.devicePixelRatio * uiScale,
|
||||||
),
|
),
|
||||||
child: child!,
|
child: child!,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
child = MediaQuery(
|
child = MediaQuery(
|
||||||
data: mediaQuery.copyWith(textScaler: textScaler),
|
data: mediaQuery.copyWith(
|
||||||
|
textScaler: textScaler,
|
||||||
|
padding: tmpPadding,
|
||||||
|
viewPadding: tmpPadding,
|
||||||
|
),
|
||||||
child: child!,
|
child: child!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
..addStatusLister(playerListener);
|
..addStatusLister(playerListener);
|
||||||
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
||||||
if (plPlayerController.removeSafeArea) {
|
if (plPlayerController.removeSafeArea) {
|
||||||
hideStatusBar();
|
hideSystemBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
||||||
|
|
||||||
if (videoDetailController.removeSafeArea) {
|
if (videoDetailController.removeSafeArea) {
|
||||||
hideStatusBar();
|
hideSystemBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoDetailController.showReply) {
|
if (videoDetailController.showReply) {
|
||||||
@@ -342,7 +342,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!videoDetailController.removeSafeArea) {
|
if (!videoDetailController.removeSafeArea) {
|
||||||
showStatusBar();
|
showSystemBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoDetailController.plPlayerController.isCloseAll) {
|
if (!videoDetailController.plPlayerController.isCloseAll) {
|
||||||
|
|||||||
@@ -1474,7 +1474,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
try {
|
try {
|
||||||
if (status) {
|
if (status) {
|
||||||
if (PlatformUtils.isMobile) {
|
if (PlatformUtils.isMobile) {
|
||||||
hideStatusBar();
|
hideSystemBar();
|
||||||
await changeOrientation(
|
await changeOrientation(
|
||||||
isVertical: isVertical,
|
isVertical: isVertical,
|
||||||
orientation: orientation,
|
orientation: orientation,
|
||||||
@@ -1485,7 +1485,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
} else {
|
} else {
|
||||||
if (PlatformUtils.isMobile) {
|
if (PlatformUtils.isMobile) {
|
||||||
if (!removeSafeArea) {
|
if (!removeSafeArea) {
|
||||||
showStatusBar();
|
showSystemBar();
|
||||||
}
|
}
|
||||||
if (orientation == null && mode == .none) {
|
if (orientation == null && mode == .none) {
|
||||||
return;
|
return;
|
||||||
@@ -1632,7 +1632,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
|
|
||||||
_playerCount = 0;
|
_playerCount = 0;
|
||||||
if (removeSafeArea) {
|
if (removeSafeArea) {
|
||||||
showStatusBar();
|
showSystemBar();
|
||||||
}
|
}
|
||||||
danmakuController = null;
|
danmakuController = null;
|
||||||
_stopOrientationListener();
|
_stopOrientationListener();
|
||||||
|
|||||||
@@ -62,21 +62,22 @@ Future<void>? fullMode() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _showStatusBar = true;
|
bool _showSystemBar = true;
|
||||||
Future<void>? hideStatusBar() {
|
bool get showSystemBar_ => _showSystemBar;
|
||||||
if (!_showStatusBar) {
|
Future<void>? hideSystemBar() {
|
||||||
|
if (!_showSystemBar) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_showStatusBar = false;
|
_showSystemBar = false;
|
||||||
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
|
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
|
||||||
}
|
}
|
||||||
|
|
||||||
//退出全屏显示
|
//退出全屏显示
|
||||||
Future<void>? showStatusBar() {
|
Future<void>? showSystemBar() {
|
||||||
if (_showStatusBar) {
|
if (_showSystemBar) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_showStatusBar = true;
|
_showSystemBar = true;
|
||||||
return SystemChrome.setEnabledSystemUIMode(
|
return SystemChrome.setEnabledSystemUIMode(
|
||||||
Platform.isAndroid && Utils.sdkInt < 29 ? .manual : .edgeToEdge,
|
Platform.isAndroid && Utils.sdkInt < 29 ? .manual : .edgeToEdge,
|
||||||
overlays: SystemUiOverlay.values,
|
overlays: SystemUiOverlay.values,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
|||||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/hwdec_type.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/hwdec_type.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
|
||||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||||
import 'package:PiliPlus/utils/global_data.dart';
|
import 'package:PiliPlus/utils/global_data.dart';
|
||||||
import 'package:PiliPlus/utils/login_utils.dart';
|
import 'package:PiliPlus/utils/login_utils.dart';
|
||||||
@@ -599,14 +598,9 @@ abstract final class Pref {
|
|||||||
_setting.get(SettingBoxKey.horizontalScreen) ?? isTablet;
|
_setting.get(SettingBoxKey.horizontalScreen) ?? isTablet;
|
||||||
|
|
||||||
static bool get isTablet {
|
static bool get isTablet {
|
||||||
bool isTablet;
|
final view = WidgetsBinding.instance.platformDispatcher.views.first;
|
||||||
if (Get.context != null) {
|
final size = view.physicalSize / view.devicePixelRatio;
|
||||||
isTablet = Get.context!.isTablet;
|
final isTablet = size.shortestSide >= 600;
|
||||||
} else {
|
|
||||||
final view = WidgetsBinding.instance.platformDispatcher.views.first;
|
|
||||||
final screenSize = view.physicalSize / view.devicePixelRatio;
|
|
||||||
isTablet = screenSize.shortestSide >= 600;
|
|
||||||
}
|
|
||||||
_setting.put(SettingBoxKey.horizontalScreen, isTablet);
|
_setting.put(SettingBoxKey.horizontalScreen, isTablet);
|
||||||
return isTablet;
|
return isTablet;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user