fix: 评论区allCount为空时保底值0;添加额外的hasData判定

This commit is contained in:
orz12
2024-08-19 07:09:17 +08:00
parent d4eb95d477
commit c6b32b81f6
5 changed files with 6 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ class DynamicDetailController extends GetxController {
isLoadingMore = false;
if (res['status']) {
List<ReplyItemModel> replies = res['data'].replies;
acount.value = res['data'].cursor.allCount;
acount.value = res['data'].cursor.allCount ?? 0;
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
if (replies.isNotEmpty) {
noMore.value = '加载中...';

View File

@@ -382,7 +382,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
return FutureBuilder(
future: _futureBuilderFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
Map data = snapshot.data as Map;
if (snapshot.data['status']) {
// 请求成功

View File

@@ -73,7 +73,7 @@ class HtmlRenderController extends GetxController {
);
if (res['status']) {
List<ReplyItemModel> replies = res['data'].replies;
acount.value = res['data'].cursor.allCount;
acount.value = res['data'].cursor.allCount ?? 0;
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
if (replies.isNotEmpty) {
noMore.value = '加载中...';

View File

@@ -92,7 +92,7 @@ class VideoReplyController extends GetxController {
}
}
replies.insertAll(0, res['data'].topReplies);
count.value = res['data'].cursor.allCount;
count.value = res['data'].cursor.allCount ?? 0;
replyList.value = replies;
} else {
replyList.addAll(replies);