From be8b30147300c9df2dc36a484397327e916f6622 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 8 Sep 2024 21:22:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A82=E7=A7=92=E5=86=85=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=85=A8=E5=B1=8F=E6=97=B6=EF=BC=8C=E6=9C=AA=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=AE=9A=E6=97=B6=E6=97=8B=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugin/pl_player/controller.dart | 1 + lib/plugin/pl_player/utils/fullscreen.dart | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 8cdb56bc..20b3cf88 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -1169,6 +1169,7 @@ class PlPlayerController { // 全屏 Future triggerFullScreen({bool status = true}) async { + stopScreenTimer(); FullScreenMode mode = FullScreenModeCode.fromCode( setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; bool removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea, diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index ba95e2fb..bf8c1638 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; @@ -7,6 +8,12 @@ import 'package:flutter/services.dart'; import '../../../utils/storage.dart'; +Timer? screenTimer; +void stopScreenTimer() { + screenTimer?.cancel(); + screenTimer = null; +} + //横屏 Future landScape() async { dynamic document; @@ -32,8 +39,9 @@ Future verticalScreenForTwoSeconds() async { await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); - Future.delayed(const Duration(seconds: 2), () { + screenTimer = Timer(const Duration(seconds: 2), () { autoScreen(); + screenTimer = null; }); }