mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-06 10:40:09 +08: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/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';
|
||||||
@@ -78,7 +76,6 @@ 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;
|
||||||
@@ -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) {
|
Matrix4 _onTransform(double val) {
|
||||||
final scale = val.lerp(1.0, 0.25);
|
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);
|
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
if (_hideSystemBar) {
|
|
||||||
showSystemBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPointerDown(PointerDownEvent event) {
|
void _onPointerDown(PointerDownEvent event) {
|
||||||
@@ -336,7 +311,9 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: _padding! + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
padding:
|
||||||
|
MediaQuery.viewPaddingOf(context) +
|
||||||
|
const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ 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;
|
||||||
@@ -315,20 +313,16 @@ class MyApp extends StatelessWidget {
|
|||||||
data: mediaQuery.copyWith(
|
data: mediaQuery.copyWith(
|
||||||
textScaler: textScaler,
|
textScaler: textScaler,
|
||||||
size: mediaQuery.size / uiScale,
|
size: mediaQuery.size / uiScale,
|
||||||
padding: (tmpPadding ?? mediaQuery.padding) / uiScale,
|
padding: mediaQuery.padding / uiScale,
|
||||||
viewInsets: mediaQuery.viewInsets / uiScale,
|
viewInsets: mediaQuery.viewInsets / uiScale,
|
||||||
viewPadding: (tmpPadding ?? mediaQuery.viewPadding) / uiScale,
|
viewPadding: mediaQuery.viewPadding / uiScale,
|
||||||
devicePixelRatio: mediaQuery.devicePixelRatio * uiScale,
|
devicePixelRatio: mediaQuery.devicePixelRatio * uiScale,
|
||||||
),
|
),
|
||||||
child: child!,
|
child: child!,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
child = MediaQuery(
|
child = MediaQuery(
|
||||||
data: mediaQuery.copyWith(
|
data: mediaQuery.copyWith(textScaler: textScaler),
|
||||||
textScaler: textScaler,
|
|
||||||
padding: tmpPadding,
|
|
||||||
viewPadding: tmpPadding,
|
|
||||||
),
|
|
||||||
child: child!,
|
child: child!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
..addStatusLister(playerListener);
|
..addStatusLister(playerListener);
|
||||||
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
PlPlayerController.setPlayCallBack(plPlayerController.play);
|
||||||
if (plPlayerController.removeSafeArea) {
|
if (plPlayerController.removeSafeArea) {
|
||||||
hideSystemBar();
|
hideStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
||||||
|
|
||||||
if (videoDetailController.removeSafeArea) {
|
if (videoDetailController.removeSafeArea) {
|
||||||
hideSystemBar();
|
hideStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoDetailController.showReply) {
|
if (videoDetailController.showReply) {
|
||||||
@@ -350,7 +350,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!videoDetailController.removeSafeArea) {
|
if (!videoDetailController.removeSafeArea) {
|
||||||
showSystemBar();
|
showStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoDetailController.plPlayerController.isCloseAll) {
|
if (!videoDetailController.plPlayerController.isCloseAll) {
|
||||||
|
|||||||
@@ -1443,7 +1443,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
try {
|
try {
|
||||||
if (status) {
|
if (status) {
|
||||||
if (PlatformUtils.isMobile) {
|
if (PlatformUtils.isMobile) {
|
||||||
hideSystemBar();
|
hideStatusBar();
|
||||||
if (orientation == null && mode == .none) {
|
if (orientation == null && mode == .none) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1476,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
} else {
|
} else {
|
||||||
if (PlatformUtils.isMobile) {
|
if (PlatformUtils.isMobile) {
|
||||||
if (!removeSafeArea) {
|
if (!removeSafeArea) {
|
||||||
showSystemBar();
|
showStatusBar();
|
||||||
}
|
}
|
||||||
if (orientation == null && mode == .none) {
|
if (orientation == null && mode == .none) {
|
||||||
return;
|
return;
|
||||||
@@ -1625,7 +1625,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
|
|
||||||
_playerCount = 0;
|
_playerCount = 0;
|
||||||
if (removeSafeArea) {
|
if (removeSafeArea) {
|
||||||
showSystemBar();
|
showStatusBar();
|
||||||
}
|
}
|
||||||
danmakuController = null;
|
danmakuController = null;
|
||||||
_stopOrientationListener();
|
_stopOrientationListener();
|
||||||
|
|||||||
@@ -62,22 +62,21 @@ Future<void>? fullMode() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _showSystemBar = true;
|
bool _showStatusBar = true;
|
||||||
bool get showSystemBar_ => _showSystemBar;
|
Future<void>? hideStatusBar() {
|
||||||
Future<void>? hideSystemBar() {
|
if (!_showStatusBar) {
|
||||||
if (!_showSystemBar) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_showSystemBar = false;
|
_showStatusBar = false;
|
||||||
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
|
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
|
||||||
}
|
}
|
||||||
|
|
||||||
//退出全屏显示
|
//退出全屏显示
|
||||||
Future<void>? showSystemBar() {
|
Future<void>? showStatusBar() {
|
||||||
if (_showSystemBar) {
|
if (_showStatusBar) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_showSystemBar = true;
|
_showStatusBar = 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,
|
||||||
|
|||||||
Reference in New Issue
Block a user