From 7485400894138af441e51803b021895e9c993d9b Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 27 Oct 2024 00:45:20 +0800 Subject: [PATCH] fix: loadMore reply --- lib/models/video/reply/item.dart | 3 +++ lib/pages/video/detail/reply/widgets/reply_item.dart | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/models/video/reply/item.dart b/lib/models/video/reply/item.dart index 3ae811ec..1fa05bec 100644 --- a/lib/models/video/reply/item.dart +++ b/lib/models/video/reply/item.dart @@ -11,6 +11,7 @@ class ReplyItemModel { this.parent, this.dialog, this.count, + this.rcount, this.floor, this.state, this.fansgrade, @@ -41,6 +42,7 @@ class ReplyItemModel { int? parent; int? dialog; int? count; + int? rcount; int? floor; int? state; int? fansgrade; @@ -72,6 +74,7 @@ class ReplyItemModel { parent = json['parent']; dialog = json['dialog']; count = json['count']; + rcount = json['rcount'] ?? 0; floor = json['floor']; state = json['state']; fansgrade = json['fansgrade']; diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 051c6075..f6863466 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -1,6 +1,5 @@ import 'dart:math'; -import 'package:appscheme/appscheme.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -60,9 +59,7 @@ class ReplyItem extends StatelessWidget { return; } feedBack(); - if (replyReply != null) { - replyReply!(replyItem, null, replyItem!.replies!.isNotEmpty); - } + replyReply?.call(replyItem, null, replyItem!.rcount! > 0); }, onLongPress: () { if (replySave!) { @@ -289,9 +286,7 @@ class ReplyItem extends StatelessWidget { // 操作区域 bottonAction(context, replyItem!.replyControl, replySave), // 一楼的评论 - if ((replyItem!.replyControl!.isShow! || - replyItem!.replies!.isNotEmpty) && - showReplyRow!) ...[ + if ((replyItem!.rcount! > 0) && showReplyRow!) ...[ Padding( padding: const EdgeInsets.only(top: 5, bottom: 12), child: ReplyItemRow( @@ -408,8 +403,7 @@ class ReplyItemRow extends StatelessWidget { @override Widget build(BuildContext context) { - final bool isShow = replyControl!.isShow!; - final int extraRow = replyControl != null && isShow ? 1 : 0; + final int extraRow = replyItem!.rcount! > 0 ? 1 : 0; ColorScheme colorScheme = Theme.of(context).colorScheme; TextTheme textTheme = Theme.of(context).textTheme;