From d870c36a96197f9947612fabf157b08f326c19de Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 2 Apr 2025 12:32:29 +0800 Subject: [PATCH] mod: custom slide fs Closes #585 Signed-off-by: bggRGjQaUbCoE --- lib/pages/setting/widgets/model.dart | 7 +++++++ lib/plugin/pl_player/controller.dart | 1 + lib/plugin/pl_player/view.dart | 15 +++++++++++++++ lib/utils/storage.dart | 4 ++++ 4 files changed, 27 insertions(+) diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index 850cea54..c5dd3576 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -752,6 +752,13 @@ List get playSettings => [ setKey: SettingBoxKey.enableSlideVolumeBrightness, defaultVal: true, ), + SettingsModel( + settingsType: SettingsType.sw1tch, + title: '中间滑动进入/退出全屏', + leading: Icon(MdiIcons.panVertical), + setKey: SettingBoxKey.enableSlideFS, + defaultVal: true, + ), SettingsModel( settingsType: SettingsType.normal, title: '自动启用字幕', diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index fc2c0068..172c33b2 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -255,6 +255,7 @@ class PlPlayerController { late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize; late final darkVideoPage = GStorage.darkVideoPage; late final enableSlideVolumeBrightness = GStorage.enableSlideVolumeBrightness; + late final enableSlideFS = GStorage.enableSlideFS; /// 弹幕权重 int danmakuWeight = 0; diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 7449f2d6..4a501ad2 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -767,6 +767,11 @@ class _PLVideoPlayerState extends State /// 锁定时禁用 if (plPlayerController.controlsLock.value) return; + if (plPlayerController.enableSlideVolumeBrightness.not && + plPlayerController.enableSlideFS.not) { + return; + } + RenderBox renderBox = _playerKey.currentContext!.findRenderObject() as RenderBox; @@ -788,6 +793,9 @@ class _PLVideoPlayerState extends State // 左边区域 _gestureType = 'left'; } else if (tapPosition < sectionWidth * 2) { + if (plPlayerController.enableSlideFS.not) { + return; + } // 全屏 _gestureType = 'center'; } else { @@ -1160,6 +1168,10 @@ class _PLVideoPlayerState extends State }, onVerticalDragUpdate: (details) { if (plPlayerController.controlsLock.value) return; + if (plPlayerController.enableSlideVolumeBrightness.not && + plPlayerController.enableSlideFS.not) { + return; + } RenderBox renderBox = _playerKey.currentContext!.findRenderObject() as RenderBox; final double totalWidth = renderBox.size.width; @@ -1173,6 +1185,9 @@ class _PLVideoPlayerState extends State // 左边区域 gestureType = 'left'; } else if (tapPosition < sectionWidth * 2) { + if (plPlayerController.enableSlideFS.not) { + return; + } // 全屏 gestureType = 'center'; } else { diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index fee20520..178db79e 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -417,6 +417,9 @@ class GStorage { static bool get enableSlideVolumeBrightness => GStorage.setting .get(SettingBoxKey.enableSlideVolumeBrightness, defaultValue: true); + static bool get enableSlideFS => + GStorage.setting.get(SettingBoxKey.enableSlideFS, defaultValue: true); + static int get retryCount => GStorage.setting.get(SettingBoxKey.retryCount, defaultValue: 2); @@ -707,6 +710,7 @@ class SettingBoxKey { showDynActionBar = 'showDynActionBar', darkVideoPage = 'darkVideoPage', enableSlideVolumeBrightness = 'enableSlideVolumeBrightness', + enableSlideFS = 'enableSlideFS', retryCount = 'retryCount', retryDelay = 'retryDelay', liveQuality = 'liveQuality',