diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart index 6e15528d..bbf2be58 100644 --- a/lib/common/widgets/network_img_layer.dart +++ b/lib/common/widgets/network_img_layer.dart @@ -90,7 +90,9 @@ class NetworkImgLayer extends StatelessWidget { imageBuilder: imageBuilder, errorListener: (value) { thumbnail = false; - (context as Element).markNeedsBuild(); + if (context.mounted) { + (context as Element).markNeedsBuild(); + } }, ), ), diff --git a/lib/http/video.dart b/lib/http/video.dart index 0057a60d..4dd688d2 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -805,7 +805,7 @@ class VideoHttp { 'cid': cid, }); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return {'status': true, 'data': res.data['data']['total']}; } else { return {'status': false, 'data': null, 'msg': res.data['message']}; } diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index a2305617..c1e07b5f 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -554,6 +554,8 @@ class VideoDetailController extends GetxController }, options: _options, ); + segmentList.clear(); + _segmentProgressList = null; _handleSBData(result); } diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 3b496f43..9178e8a1 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -567,6 +567,9 @@ class VideoIntroController extends GetxController this.bvid = bvid; lastPlayCid.value = cid; queryVideoIntro(); + if (isShowOnlineTotal) { + queryOnlineTotal(); + } } void startTimer() { @@ -588,15 +591,15 @@ class VideoIntroController extends GetxController // 查看同时在看人数 Future queryOnlineTotal() async { - // var result = await VideoHttp.onlineTotal( - // aid: IdUtils.bv2av(bvid), - // bvid: bvid, - // cid: lastPlayCid.value, - // ); - dynamic result = await GrpcRepo.playerOnline( + dynamic result = await VideoHttp.onlineTotal( aid: IdUtils.bv2av(bvid), + bvid: bvid, cid: lastPlayCid.value, ); + // dynamic result = await GrpcRepo.playerOnline( + // aid: IdUtils.bv2av(bvid), + // cid: lastPlayCid.value, + // ); if (result['status']) { total.value = result['data']; } diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 5594704c..5a563acd 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -158,7 +158,7 @@ class _VideoInfoState extends State with TickerProviderStateMixin { late final _coinKey = GlobalKey(); late final _favKey = GlobalKey(); - late final _expandableCtr = ExpandableController(initialExpanded: false); + final _expandableCtr = ExpandableController(initialExpanded: false); @override void initState() { diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index e9ec1a36..4b183795 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -501,6 +501,11 @@ class _VideoDetailPageState extends State Orientation.portrait), onPopInvokedWithResult: (bool didPop, Object? result) { + if (plPlayerController?.controlsLock.value == + true) { + plPlayerController?.onLockControl(false); + return; + } if (isFullScreen) { plPlayerController! .triggerFullScreen(status: false); @@ -562,6 +567,10 @@ class _VideoDetailPageState extends State child: PopScope( canPop: !isFullScreen, onPopInvokedWithResult: (bool didPop, Object? result) { + if (plPlayerController?.controlsLock.value == true) { + plPlayerController?.onLockControl(false); + return; + } if (isFullScreen) { plPlayerController!.triggerFullScreen(status: false); } @@ -614,6 +623,10 @@ class _VideoDetailPageState extends State child: PopScope( canPop: !isFullScreen, onPopInvokedWithResult: (bool didPop, Object? result) { + if (plPlayerController?.controlsLock.value == true) { + plPlayerController?.onLockControl(false); + return; + } if (isFullScreen) { plPlayerController!.triggerFullScreen(status: false); } @@ -668,6 +681,10 @@ class _VideoDetailPageState extends State child: PopScope( canPop: !isFullScreen, onPopInvokedWithResult: (bool didPop, Object? result) { + if (plPlayerController?.controlsLock.value == true) { + plPlayerController?.onLockControl(false); + return; + } if (isFullScreen) { plPlayerController!.triggerFullScreen(status: false); } @@ -745,6 +762,10 @@ class _VideoDetailPageState extends State child: PopScope( canPop: !isFullScreen, onPopInvokedWithResult: (bool didPop, Object? result) { + if (plPlayerController?.controlsLock.value == true) { + plPlayerController?.onLockControl(false); + return; + } if (isFullScreen) { plPlayerController!.triggerFullScreen(status: false); } diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 450e61de..cdbd8521 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1437,36 +1437,40 @@ class _HeaderControlState extends State { constraints: BoxConstraints( maxWidth: boxConstraints.maxWidth / 2 - 60, maxHeight: 25), - child: Marquee( - text: videoIntroController.videoDetail.value.title!, - style: const TextStyle( - color: Colors.white, - fontSize: 16, + child: Obx( + () => Marquee( + text: videoIntroController.videoDetail.value.title!, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + ), + scrollAxis: Axis.horizontal, + crossAxisAlignment: CrossAxisAlignment.start, + blankSpace: 200, + velocity: 40, + startAfter: const Duration(seconds: 1), + showFadingOnlyWhenScrolling: true, + fadingEdgeStartFraction: 0, + fadingEdgeEndFraction: 0.1, + numberOfRounds: 1, + startPadding: 0, + accelerationDuration: const Duration(seconds: 1), + accelerationCurve: Curves.linear, + decelerationDuration: const Duration(milliseconds: 500), + decelerationCurve: Curves.easeOut, ), - scrollAxis: Axis.horizontal, - crossAxisAlignment: CrossAxisAlignment.start, - blankSpace: 200, - velocity: 40, - startAfter: const Duration(seconds: 1), - showFadingOnlyWhenScrolling: true, - fadingEdgeStartFraction: 0, - fadingEdgeEndFraction: 0.1, - numberOfRounds: 1, - startPadding: 0, - accelerationDuration: const Duration(seconds: 1), - accelerationCurve: Curves.linear, - decelerationDuration: const Duration(milliseconds: 500), - decelerationCurve: Curves.easeOut, ), ), if (videoIntroController.isShowOnlineTotal) - Text( - '${videoIntroController.total.value}人正在看', - style: const TextStyle( - color: Colors.white, - fontSize: 11, + Obx( + () => Text( + '${videoIntroController.total.value}人正在看', + style: const TextStyle( + color: Colors.white, + fontSize: 11, + ), ), - ) + ), ], ), const Spacer(),