From de83f156d88e4e10abb65da0de2a0afebde6c1de Mon Sep 17 00:00:00 2001 From: guozhigq Date: Tue, 11 Jun 2024 22:59:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=B9=E5=B9=95=E6=98=BE=E7=A4=BA&?= =?UTF-8?q?=E5=BC=B9=E5=B9=95=E8=AE=BE=E7=BD=AE=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 41 +++++++++++-------- .../video/detail/widgets/header_control.dart | 4 +- lib/plugin/pl_player/controller.dart | 17 +++++--- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index a0f5d6bc..a99ee936 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -591,27 +591,32 @@ class _VideoDetailPageState extends State verticalScreen(); } }, - child: Hero( - tag: heroTag, - child: Stack( - children: [ - if (isShowing) videoPlayerPanel, + child: LayoutBuilder( + builder: (BuildContext context, + BoxConstraints constraints) { + return Hero( + tag: heroTag, + child: Stack( + children: [ + if (isShowing) videoPlayerPanel, - /// 关闭自动播放时 手动播放 - Obx( - () => Visibility( - visible: !vdCtr.autoPlay.value && - vdCtr.isShowCover.value, - child: Positioned( - top: 0, - left: 0, - right: 0, - child: handlePlayPanel(), + /// 关闭自动播放时 手动播放 + Obx( + () => Visibility( + visible: !vdCtr.autoPlay.value && + vdCtr.isShowCover.value, + child: Positioned( + top: 0, + left: 0, + right: 0, + child: handlePlayPanel(), + ), + ), ), - ), + ], ), - ], - ), + ); + }, ), ), ), diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index d839a1eb..b597a060 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1069,7 +1069,9 @@ class _HeaderControlState extends State { ); }); }, - ); + ).then((value) { + widget.controller!.cacheDanmakuOption(); + }); } /// 播放顺序 diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index f9dbba04..10297f0a 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -1107,6 +1107,16 @@ class PlPlayerController { videoStorage.put(VideoBoxKey.playRepeat, type.value); } + /// 缓存本次弹幕选项 + cacheDanmakuOption() { + localCache.put(LocalCacheKey.danmakuBlockType, blockTypes); + localCache.put(LocalCacheKey.danmakuShowArea, showArea); + localCache.put(LocalCacheKey.danmakuOpacity, opacityVal); + localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal); + localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal); + localCache.put(LocalCacheKey.strokeWidth, strokeWidth); + } + Future dispose({String type = 'single'}) async { // 每次减1,最后销毁 if (type == 'single' && playerCount.value > 1) { @@ -1136,12 +1146,7 @@ class PlPlayerController { // dataStatus.status.close(); /// 缓存本次弹幕选项 - localCache.put(LocalCacheKey.danmakuBlockType, blockTypes); - localCache.put(LocalCacheKey.danmakuShowArea, showArea); - localCache.put(LocalCacheKey.danmakuOpacity, opacityVal); - localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal); - localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal); - localCache.put(LocalCacheKey.strokeWidth, strokeWidth); + cacheDanmakuOption(); if (_videoPlayerController != null) { var pp = _videoPlayerController!.platform as NativePlayer; await pp.setProperty('audio-files', '');