From 801043468d05fbecd324a3a8dfe0b94c95f01c68 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Fri, 28 Feb 2025 10:16:02 +0800 Subject: [PATCH] fix: getPlayerKey Signed-off-by: bggRGjQaUbCoE --- lib/plugin/pl_player/controller.dart | 4 ++-- lib/plugin/pl_player/view.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 19be9280..3708cdb4 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -311,10 +311,10 @@ class PlPlayerController { textScaleFactor: MediaQuery.textScalerOf(Get.context!).scale(1), ); - late Function getPlayerKey; + Function? getPlayerKey; void updateSubtitleStyle() { - getPlayerKey().currentState?.update( + getPlayerKey?.call()?.currentState?.update( subtitleViewConfiguration: subtitleViewConfiguration, ); } diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 0fbecb7e..bb1412c1 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -161,6 +161,7 @@ class _PLVideoPlayerState extends State @override void initState() { super.initState(); + plPlayerController.getPlayerKey = () => key; animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 100)); videoController = plPlayerController.videoController!; @@ -169,7 +170,6 @@ class _PLVideoPlayerState extends State plPlayerController.headerControl = widget.headerControl; plPlayerController.bottomControl = widget.bottomControl; plPlayerController.danmuWidget = widget.danmuWidget; - plPlayerController.getPlayerKey = () => key; defaultBtmProgressBehavior = GStorage.setting.get( SettingBoxKey.btmProgressBehavior, defaultValue: BtmProgressBehavior.values.first.code);