fix: 视频简介渲染异常、二楼新回复的评论渲染异常

This commit is contained in:
guozhigq
2023-09-16 22:51:04 +08:00
parent 380ada9ae0
commit e9095932ed
4 changed files with 38 additions and 29 deletions

View File

@ -199,6 +199,9 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
// 视频介绍 // 视频介绍
showIntroDetail() { showIntroDetail() {
if (loadingStatus) {
return;
}
feedBack(); feedBack();
showBottomSheet( showBottomSheet(
context: context, context: context,
@ -254,22 +257,25 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
SizedBox( Opacity(
width: 34, opacity: loadingStatus ? 0 : 1,
height: 34, child: SizedBox(
child: IconButton( width: 34,
style: ButtonStyle( height: 34,
padding: child: IconButton(
MaterialStateProperty.all(EdgeInsets.zero), style: ButtonStyle(
backgroundColor: padding:
MaterialStateProperty.resolveWith((states) { MaterialStateProperty.all(EdgeInsets.zero),
return t.highlightColor.withOpacity(0.2); backgroundColor:
}), MaterialStateProperty.resolveWith((states) {
), return t.highlightColor.withOpacity(0.2);
onPressed: showIntroDetail, }),
icon: Icon( ),
Icons.more_horiz, onPressed: showIntroDetail,
color: Theme.of(context).colorScheme.primary, icon: Icon(
Icons.more_horiz,
color: Theme.of(context).colorScheme.primary,
),
), ),
), ),
), ),

View File

@ -26,11 +26,6 @@ class VideoReplyReplyController extends GetxController {
currentPage = 0; currentPage = 0;
} }
// 上拉加载
Future onLoad() async {
queryReplyList(type: 'onLoad');
}
Future queryReplyList({type = 'init'}) async { Future queryReplyList({type = 'init'}) async {
if (type == 'init') { if (type == 'init') {
currentPage = 0; currentPage = 0;
@ -49,11 +44,11 @@ class VideoReplyReplyController extends GetxController {
if (replyList.length == res['data'].page.count) { if (replyList.length == res['data'].page.count) {
noMore.value = '没有更多了'; noMore.value = '没有更多了';
} }
currentPage++;
} else { } else {
// 未登录状态replies可能返回null // 未登录状态replies可能返回null
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了'; noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
} }
currentPage++;
if (type == 'init') { if (type == 'init') {
// List<ReplyItemModel> replies = res['data'].replies; // List<ReplyItemModel> replies = res['data'].replies;
// 添加置顶回复 // 添加置顶回复
@ -72,6 +67,10 @@ class VideoReplyReplyController extends GetxController {
// res['data'].replies = replies; // res['data'].replies = replies;
replyList.value = replies; replyList.value = replies;
} else { } else {
// 每次回复之后,翻页请求有且只有相同的一条回复数据
if (replies.length == 1 && replies.last.rpid == replyList.last.rpid) {
return;
}
replyList.addAll(replies); replyList.addAll(replies);
// res['data'].replies.addAll(replyList); // res['data'].replies.addAll(replyList);
} }

View File

@ -1,3 +1,4 @@
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
@ -54,9 +55,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
() { () {
if (scrollController.position.pixels >= if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 300) { scrollController.position.maxScrollExtent - 300) {
if (!_videoReplyReplyController.isLoadingMore) { EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
_videoReplyReplyController.onLoad(); _videoReplyReplyController.queryReplyList(type: 'onLoad');
} });
} }
}, },
); );

View File

@ -99,10 +99,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController!.triggerFullScreen(status: false); plPlayerController!.triggerFullScreen(status: false);
} }
// 播放完展示控制栏 // 播放完展示控制栏
PiPStatus currentStatus = await videoDetailController.floating!.pipStatus; try {
if (currentStatus == PiPStatus.disabled) { PiPStatus currentStatus =
plPlayerController!.onLockControl(false); await videoDetailController.floating!.pipStatus;
} if (currentStatus == PiPStatus.disabled) {
plPlayerController!.onLockControl(false);
}
} catch (_) {}
} }
} }