mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-20 00:04:10 +00:00
@@ -25,9 +25,7 @@ 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/viewer.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/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
@@ -78,7 +76,6 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
late final int _quality;
|
||||
late final RxInt _currIndex;
|
||||
GlobalKey? _key;
|
||||
EdgeInsets? _padding;
|
||||
|
||||
late bool _hasInit = false;
|
||||
Player? _player;
|
||||
@@ -173,25 +170,6 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
);
|
||||
}
|
||||
|
||||
final _hideSystemBar = PlatformUtils.isMobile && showSystemBar_;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
if (_padding == null) {
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
_padding = padding;
|
||||
if (_hideSystemBar) {
|
||||
tmpPadding = padding;
|
||||
hideSystemBar()!.whenComplete(
|
||||
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => tmpPadding = null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix4 _onTransform(double val) {
|
||||
final scale = val.lerp(1.0, 0.25);
|
||||
|
||||
@@ -281,9 +259,6 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
||||
super.dispose();
|
||||
if (_hideSystemBar) {
|
||||
showSystemBar();
|
||||
}
|
||||
}
|
||||
|
||||
void _onPointerDown(PointerDownEvent event) {
|
||||
@@ -336,7 +311,9 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
right: 0,
|
||||
child: IgnorePointer(
|
||||
child: Container(
|
||||
padding: _padding! + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
padding:
|
||||
MediaQuery.viewPaddingOf(context) +
|
||||
const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
|
||||
@@ -46,8 +46,6 @@ import 'package:window_manager/window_manager.dart' hide calcWindowPosition;
|
||||
|
||||
WebViewEnvironment? webViewEnvironment;
|
||||
|
||||
EdgeInsets? tmpPadding;
|
||||
|
||||
Future<void> _initDownPath() async {
|
||||
if (PlatformUtils.isDesktop) {
|
||||
final customDownPath = Pref.downloadPath;
|
||||
@@ -315,20 +313,16 @@ class MyApp extends StatelessWidget {
|
||||
data: mediaQuery.copyWith(
|
||||
textScaler: textScaler,
|
||||
size: mediaQuery.size / uiScale,
|
||||
padding: (tmpPadding ?? mediaQuery.padding) / uiScale,
|
||||
padding: mediaQuery.padding / uiScale,
|
||||
viewInsets: mediaQuery.viewInsets / uiScale,
|
||||
viewPadding: (tmpPadding ?? mediaQuery.viewPadding) / uiScale,
|
||||
viewPadding: mediaQuery.viewPadding / uiScale,
|
||||
devicePixelRatio: mediaQuery.devicePixelRatio * uiScale,
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
} else {
|
||||
child = MediaQuery(
|
||||
data: mediaQuery.copyWith(
|
||||
textScaler: textScaler,
|
||||
padding: tmpPadding,
|
||||
viewPadding: tmpPadding,
|
||||
),
|
||||
data: mediaQuery.copyWith(textScaler: textScaler),
|
||||
child: child!,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
..addStatusLister(playerListener);
|
||||
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
||||
if (plPlayerController.removeSafeArea) {
|
||||
hideSystemBar();
|
||||
hideStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
||||
|
||||
if (videoDetailController.removeSafeArea) {
|
||||
hideSystemBar();
|
||||
hideStatusBar();
|
||||
}
|
||||
|
||||
if (videoDetailController.showReply) {
|
||||
@@ -350,7 +350,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
|
||||
if (!videoDetailController.removeSafeArea) {
|
||||
showSystemBar();
|
||||
showStatusBar();
|
||||
}
|
||||
|
||||
if (!videoDetailController.plPlayerController.isCloseAll) {
|
||||
|
||||
@@ -1443,7 +1443,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
try {
|
||||
if (status) {
|
||||
if (PlatformUtils.isMobile) {
|
||||
hideSystemBar();
|
||||
hideStatusBar();
|
||||
if (orientation == null && mode == .none) {
|
||||
return;
|
||||
}
|
||||
@@ -1476,7 +1476,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
} else {
|
||||
if (PlatformUtils.isMobile) {
|
||||
if (!removeSafeArea) {
|
||||
showSystemBar();
|
||||
showStatusBar();
|
||||
}
|
||||
if (orientation == null && mode == .none) {
|
||||
return;
|
||||
@@ -1625,7 +1625,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
|
||||
_playerCount = 0;
|
||||
if (removeSafeArea) {
|
||||
showSystemBar();
|
||||
showStatusBar();
|
||||
}
|
||||
danmakuController = null;
|
||||
_stopOrientationListener();
|
||||
|
||||
@@ -62,22 +62,21 @@ Future<void>? fullMode() {
|
||||
);
|
||||
}
|
||||
|
||||
bool _showSystemBar = true;
|
||||
bool get showSystemBar_ => _showSystemBar;
|
||||
Future<void>? hideSystemBar() {
|
||||
if (!_showSystemBar) {
|
||||
bool _showStatusBar = true;
|
||||
Future<void>? hideStatusBar() {
|
||||
if (!_showStatusBar) {
|
||||
return null;
|
||||
}
|
||||
_showSystemBar = false;
|
||||
_showStatusBar = false;
|
||||
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
|
||||
}
|
||||
|
||||
//退出全屏显示
|
||||
Future<void>? showSystemBar() {
|
||||
if (_showSystemBar) {
|
||||
Future<void>? showStatusBar() {
|
||||
if (_showStatusBar) {
|
||||
return null;
|
||||
}
|
||||
_showSystemBar = true;
|
||||
_showStatusBar = true;
|
||||
return SystemChrome.setEnabledSystemUIMode(
|
||||
Platform.isAndroid && Utils.sdkInt < 29 ? .manual : .edgeToEdge,
|
||||
overlays: SystemUiOverlay.values,
|
||||
|
||||
Reference in New Issue
Block a user