Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-04 13:57:39 +08:00
parent 0483096f93
commit 8476e0b37c
5 changed files with 4 additions and 631 deletions

View File

@@ -2,12 +2,7 @@ import 'dart:io' show Platform;
import 'package:PiliPlus/utils/device_utils.dart';
import 'package:flutter/services.dart'
show
SystemChrome,
MethodChannel,
SystemUiOverlay,
DeviceOrientation,
SystemUiMode;
show SystemChrome, MethodChannel, SystemUiOverlay, DeviceOrientation;
bool _isDesktopFullScreen = false;
@@ -73,7 +68,7 @@ Future<void>? hideSystemBar() {
return null;
}
_showSystemBar = false;
return setEnabledSystemUIMode(.immersiveSticky);
return SystemChrome.setEnabledSystemUIMode(.immersiveSticky);
}
//退出全屏显示
@@ -82,35 +77,8 @@ Future<void>? showSystemBar() {
return null;
}
_showSystemBar = true;
return setEnabledSystemUIMode(
return SystemChrome.setEnabledSystemUIMode(
Platform.isAndroid && DeviceUtils.sdkInt < 29 ? .manual : .edgeToEdge,
overlays: SystemUiOverlay.values,
);
}
// TODO: remove
// https://github.com/flutter/flutter/issues/186723
Future<void> setEnabledSystemUIMode(
SystemUiMode mode, {
List<SystemUiOverlay>? overlays,
}) {
if (!Platform.isAndroid) {
return SystemChrome.setEnabledSystemUIMode(mode, overlays: overlays);
}
if (mode != SystemUiMode.manual) {
return const MethodChannel('PiliPlus').invokeMethod(
'SystemChrome.setEnabledSystemUIMode',
{'arguments': mode.toString()},
);
} else {
assert(mode == SystemUiMode.manual && overlays != null);
return const MethodChannel('PiliPlus').invokeMethod(
'SystemChrome.setEnabledSystemUIOverlays',
{'arguments': _stringify(overlays!)},
);
}
}
List<String> _stringify(List<dynamic> list) => <String>[
for (final dynamic item in list) item.toString(),
];

View File

@@ -33,7 +33,6 @@ import 'package:PiliPlus/plugin/pl_player/models/double_tap_type.dart';
import 'package:PiliPlus/plugin/pl_player/models/gesture_type.dart';
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
import 'package:PiliPlus/plugin/pl_player/models/video_fit_type.dart';
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
import 'package:PiliPlus/plugin/pl_player/view/simple_video_texture.dart';
import 'package:PiliPlus/plugin/pl_player/widgets/app_bar_ani.dart';
import 'package:PiliPlus/plugin/pl_player/widgets/backward_seek.dart';
@@ -277,12 +276,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// TODO: remove
// part of https://github.com/flutter/flutter/issues/186723
if (Platform.isAndroid && state == .resumed && !showSystemBar_) {
setEnabledSystemUIMode(.immersiveSticky);
}
if (!plPlayerController.continuePlayInBackground.value) {
late final player = plPlayerController.videoPlayerController;
if (const <AppLifecycleState>[.paused, .detached].contains(state)) {