保持屏幕 唤醒 + 隐藏 系统状态栏

This commit is contained in:
shikong 2023-11-26 20:04:42 +08:00
parent 174f3e9341
commit b08fa90fc1

View File

@ -28,7 +28,7 @@ class _CustomVideoPlayerState extends State<CustomVideoPlayer> {
void initState() {
super.initState();
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky, overlays: [SystemUiOverlay.bottom]);
SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
Wakelock.enable();
@ -178,7 +178,7 @@ class _CustomVideoPlayerState extends State<CustomVideoPlayer> {
@override
void dispose() {
Wakelock.disable();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky, overlays: [SystemUiOverlay.top]);
SystemChrome.setPreferredOrientations([]);
player?.stop().then((value) => player?.dispose());
_controller?.dispose();