From aa4e251295429c959854af3898e191020a6e1655 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 21 Jan 2024 11:37:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=86=E9=A2=91=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/related/view.dart | 3 ++- lib/pages/video/detail/view.dart | 2 +- lib/plugin/pl_player/controller.dart | 15 ++++++++------- lib/plugin/pl_player/view.dart | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/pages/video/detail/related/view.dart b/lib/pages/video/detail/related/view.dart index 5b6fdc96..51c296f3 100644 --- a/lib/pages/video/detail/related/view.dart +++ b/lib/pages/video/detail/related/view.dart @@ -9,7 +9,8 @@ import './controller.dart'; class RelatedVideoPanel extends StatelessWidget { final ReleatedController _releatedController = - Get.put(ReleatedController(), tag: Get.arguments['heroTag']); + Get.put(ReleatedController(), tag: Get.arguments?['heroTag']); + RelatedVideoPanel({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index d063c3b2..59fa39b2 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -235,7 +235,7 @@ class _VideoDetailPageState extends State videoIntroController.isPaused = false; if (_extendNestCtr.position.pixels == 0 && autoplay) { await Future.delayed(const Duration(milliseconds: 300)); - plPlayerController!.seekTo(videoDetailController.defaultST); + plPlayerController?.seekTo(videoDetailController.defaultST); plPlayerController?.play(); } plPlayerController?.addStatusLister(playerListener); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index fd3f02c9..aeb705c6 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -621,7 +621,7 @@ class PlPlayerController { if (duration.value.inSeconds != 0) { if (type != 'slider') { /// 拖动进度条调节时,不等待第一帧,防止抖动 - await _videoPlayerController!.stream.buffer.first; + await _videoPlayerController?.stream.buffer.first; } await _videoPlayerController?.seek(position); // if (playerStatus.stopped) { @@ -1086,12 +1086,13 @@ class PlPlayerController { localCache.put(LocalCacheKey.danmakuOpacity, opacityVal); localCache.put(LocalCacheKey.danmakuFontScale, fontSizeVal); localCache.put(LocalCacheKey.danmakuDuration, danmakuDurationVal); - - var pp = _videoPlayerController!.platform as NativePlayer; - await pp.setProperty('audio-files', ''); - removeListeners(); - await _videoPlayerController?.dispose(); - _videoPlayerController = null; + if (_videoPlayerController != null) { + var pp = _videoPlayerController!.platform as NativePlayer; + await pp.setProperty('audio-files', ''); + removeListeners(); + await _videoPlayerController?.dispose(); + _videoPlayerController = null; + } _instance = null; // 关闭所有视频页面恢复亮度 resetBrightness(); diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 860342ef..b289dde0 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -703,7 +703,7 @@ class _PLVideoPlayerState extends State ), ); } else { - return nil; + return const SizedBox(); } }),