From a51aa1ce132dca2e518f0d4ce6afa75bca60043a Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 25 Aug 2024 23:54:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=B6=88=E5=A4=B1=E6=97=B6=E9=97=B4=E5=BB=B6?= =?UTF-8?q?=E9=95=BF10=E5=80=8D=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/play_setting.dart | 9 ++++++++- lib/pages/setting/style_setting.dart | 2 +- lib/plugin/pl_player/controller.dart | 6 +++++- lib/utils/storage.dart | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/pages/setting/play_setting.dart b/lib/pages/setting/play_setting.dart index a5fccb59..10496f7c 100644 --- a/lib/pages/setting/play_setting.dart +++ b/lib/pages/setting/play_setting.dart @@ -85,7 +85,7 @@ class _PlaySettingState extends State { ), const SetSwitchItem( title: '双击快退/快进', - subTitle: '左侧双击快退,右侧双击快进', + subTitle: '左侧双击快退/右侧双击快进,关闭则双击均为暂停/播放', leading: Icon(Icons.touch_app_outlined), setKey: SettingBoxKey.enableQuickDouble, defaultVal: true, @@ -139,6 +139,13 @@ class _PlaySettingState extends State { setKey: SettingBoxKey.enableAutoExit, defaultVal: true, ), + const SetSwitchItem( + title: '延长播放控件显示时间', + subTitle: '开启后延长至30秒,便于屏幕阅读器滑动切换控件焦点', + leading: Icon(Icons.timer_outlined), + setKey: SettingBoxKey.enableLongShowControl, + defaultVal: false + ), const SetSwitchItem( title: '全向旋转', subTitle: '小屏可受重力转为临时全屏,若系统锁定旋转仍触发请关闭,关闭会影响横屏适配', diff --git a/lib/pages/setting/style_setting.dart b/lib/pages/setting/style_setting.dart index a716ae9f..d0fcaf13 100644 --- a/lib/pages/setting/style_setting.dart +++ b/lib/pages/setting/style_setting.dart @@ -69,7 +69,7 @@ class _StyleSettingState extends State { children: [ SetSwitchItem( title: '横屏适配', - subTitle: '启用横屏布局与逻辑,适用于平板等设备;推荐全屏方向设为【不改变当前方向】', + subTitle: '启用横屏布局与逻辑,平板、折叠屏等可开启;建议全屏方向设为【不改变当前方向】', leading: const Icon(Icons.phonelink_outlined), setKey: SettingBoxKey.horizontalScreen, defaultVal: false, diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 5a86af82..9b98f0fd 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -253,6 +253,7 @@ class PlPlayerController { late List speedsList; double? defaultDuration; late bool enableAutoLongPressSpeed = false; + late bool enableLongShowControl; // 播放顺序相关 PlayRepeat playRepeat = PlayRepeat.pause; @@ -361,6 +362,8 @@ class PlPlayerController { _longPressSpeed.value = videoStorage .get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0); } + enableLongShowControl = + setting.get(SettingBoxKey.enableLongShowControl, defaultValue: false); speedsList = List.from(videoStorage .get(VideoBoxKey.customSpeedsList, defaultValue: [])); for (final PlaySpeed i in PlaySpeed.values) { @@ -927,7 +930,8 @@ class PlPlayerController { if (_timer != null) { _timer!.cancel(); } - _timer = Timer(const Duration(milliseconds: 3000), () { + Duration waitingTime = Duration(seconds: enableLongShowControl ? 30 : 3); + _timer = Timer(waitingTime, () { if (!isSliderMoving.value) { controls = false; } diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 1a4924e5..61883da1 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -112,6 +112,7 @@ class SettingBoxKey { enableAutoBrightness = 'enableAutoBrightness', enableAutoEnter = 'enableAutoEnter', enableAutoExit = 'enableAutoExit', + enableLongShowControl = 'enableLongShowControl', allowRotateScreen = 'allowRotateScreen', horizontalScreen = 'horizontalScreen', p1080 = 'p1080',