mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-24 11:10:15 +08:00
@@ -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(),
|
||||
];
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user