feat: 播放器控制栏动画开关

This commit is contained in:
guozhigq
2024-03-02 11:19:18 +08:00
parent f815affff9
commit f0d8e2a122
4 changed files with 18 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import 'package:pilipala/models/video/play/quality.dart';
import 'package:pilipala/pages/setting/widgets/select_dialog.dart'; import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
import 'package:pilipala/plugin/pl_player/index.dart'; import 'package:pilipala/plugin/pl_player/index.dart';
import 'package:pilipala/services/service_locator.dart'; import 'package:pilipala/services/service_locator.dart';
import 'package:pilipala/utils/global_data.dart';
import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/storage.dart';
import 'widgets/switch_item.dart'; import 'widgets/switch_item.dart';
@ -146,6 +147,14 @@ class _PlaySettingState extends State<PlaySetting> {
setKey: SettingBoxKey.enableShowDanmaku, setKey: SettingBoxKey.enableShowDanmaku,
defaultVal: false, defaultVal: false,
), ),
SetSwitchItem(
title: '控制栏动画',
subTitle: '播放器控制栏显示动画效果',
setKey: SettingBoxKey.enablePlayerControlAnimation,
defaultVal: true,
callFn: (bool val) {
GlobalData().enablePlayerControlAnimation = val;
}),
ListTile( ListTile(
dense: false, dense: false,
title: Text('默认画质', style: titleStyle), title: Text('默认画质', style: titleStyle),

View File

@ -120,7 +120,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
super.initState(); super.initState();
screenWidth = Get.size.width; screenWidth = Get.size.width;
animationController = AnimationController( animationController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 300)); vsync: this,
duration: GlobalData().enablePlayerControlAnimation
? const Duration(milliseconds: 150)
: const Duration(milliseconds: 10),
);
videoController = widget.controller.videoController!; videoController = widget.controller.videoController!;
widget.controller.headerControl = widget.headerControl; widget.controller.headerControl = widget.headerControl;
widget.controller.bottomControl = widget.bottomControl; widget.controller.bottomControl = widget.bottomControl;

View File

@ -4,6 +4,7 @@ class GlobalData {
int imgQuality = 10; int imgQuality = 10;
FullScreenGestureMode fullScreenGestureMode = FullScreenGestureMode fullScreenGestureMode =
FullScreenGestureMode.values.last; FullScreenGestureMode.values.last;
bool enablePlayerControlAnimation = true;
// 私有构造函数 // 私有构造函数
GlobalData._(); GlobalData._();

View File

@ -49,6 +49,8 @@ class GStrorage {
GlobalData().fullScreenGestureMode = FullScreenGestureMode.values[ GlobalData().fullScreenGestureMode = FullScreenGestureMode.values[
setting.get(SettingBoxKey.fullScreenGestureMode, setting.get(SettingBoxKey.fullScreenGestureMode,
defaultValue: FullScreenGestureMode.values.last.index) as int]; defaultValue: FullScreenGestureMode.values.last.index) as int];
GlobalData().enablePlayerControlAnimation = setting
.get(SettingBoxKey.enablePlayerControlAnimation, defaultValue: true);
} }
static void regAdapter() { static void regAdapter() {
@ -98,6 +100,7 @@ class SettingBoxKey {
enableCDN = 'enableCDN', enableCDN = 'enableCDN',
autoPiP = 'autoPiP', autoPiP = 'autoPiP',
enableAutoLongPressSpeed = 'enableAutoLongPressSpeed', enableAutoLongPressSpeed = 'enableAutoLongPressSpeed',
enablePlayerControlAnimation = 'enablePlayerControlAnimation',
// youtube 双击快进快退 // youtube 双击快进快退
enableQuickDouble = 'enableQuickDouble', enableQuickDouble = 'enableQuickDouble',