Compare commits

..

2 Commits

Author SHA1 Message Date
f41bb02bae fix: 合集最后一p不显示 issues #620 2024-03-08 23:05:09 +08:00
3bf6136bc6 fix: 楼中楼评论请求重复 #284 2024-03-08 00:03:34 +08:00
4 changed files with 10 additions and 21 deletions

View File

@ -144,9 +144,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
Expanded( Expanded(
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: widget.pages.length, itemCount: widget.pages.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == widget.pages.length - 1; bool isLastItem = index == widget.pages.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(

View File

@ -161,9 +161,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
Expanded( Expanded(
child: Material( child: Material(
child: ScrollablePositionedList.builder( child: ScrollablePositionedList.builder(
itemCount: episodes.length, itemCount: episodes.length + 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
bool isLastItem = index == episodes.length - 1; bool isLastItem = index == episodes.length;
bool isCurrentIndex = currentIndex == index; bool isCurrentIndex = currentIndex == index;
return isLastItem return isLastItem
? SizedBox( ? SizedBox(

View File

@ -30,6 +30,9 @@ class VideoReplyReplyController extends GetxController {
if (type == 'init') { if (type == 'init') {
currentPage = 0; currentPage = 0;
} }
if (isLoadingMore) {
return;
}
isLoadingMore = true; isLoadingMore = true;
final res = await ReplyHttp.replyReplyList( final res = await ReplyHttp.replyReplyList(
oid: aid!, oid: aid!,
@ -41,7 +44,7 @@ class VideoReplyReplyController extends GetxController {
final List<ReplyItemModel> replies = res['data'].replies; final List<ReplyItemModel> replies = res['data'].replies;
if (replies.isNotEmpty) { if (replies.isNotEmpty) {
noMore.value = '加载中...'; noMore.value = '加载中...';
if (replyList.length == res['data'].page.count) { if (replies.length == res['data'].page.count) {
noMore.value = '没有更多了'; noMore.value = '没有更多了';
} }
currentPage++; currentPage++;
@ -50,21 +53,6 @@ class VideoReplyReplyController extends GetxController {
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了'; noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
} }
if (type == 'init') { if (type == 'init') {
// List<ReplyItemModel> replies = res['data'].replies;
// 添加置顶回复
// if (res['data'].upper.top != null) {
// bool flag = false;
// for (var i = 0; i < res['data'].topReplies.length; i++) {
// if (res['data'].topReplies[i].rpid == res['data'].upper.top.rpid) {
// flag = true;
// }
// }
// if (!flag) {
// replies.insert(0, res['data'].upper.top);
// }
// }
// replies.insertAll(0, res['data'].topReplies);
// res['data'].replies = replies;
replyList.value = replies; replyList.value = replies;
} else { } else {
// 每次回复之后,翻页请求有且只有相同的一条回复数据 // 每次回复之后,翻页请求有且只有相同的一条回复数据

View File

@ -54,7 +54,8 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
() { () {
if (scrollController.position.pixels >= if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 300) { scrollController.position.maxScrollExtent - 300) {
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () { EasyThrottle.throttle('replylist', const Duration(milliseconds: 200),
() {
_videoReplyReplyController.queryReplyList(type: 'onLoad'); _videoReplyReplyController.queryReplyList(type: 'onLoad');
}); });
} }