mod
This commit is contained in:
@ -17,7 +17,7 @@ class VideoReplyReplyController extends GetxController {
|
||||
// 当前页
|
||||
int currentPage = 0;
|
||||
bool isLoadingMore = false;
|
||||
RxBool noMore = false.obs;
|
||||
RxString noMore = ''.obs;
|
||||
// 当前回复的回复
|
||||
ReplyItemModel? currentReplyItem;
|
||||
|
||||
@ -38,27 +38,25 @@ class VideoReplyReplyController extends GetxController {
|
||||
}
|
||||
isLoadingMore = true;
|
||||
var res = await ReplyHttp.replyReplyList(
|
||||
oid: aid!,
|
||||
root: rpid!,
|
||||
pageNum: currentPage + 1,
|
||||
type: replyType.index);
|
||||
oid: aid!,
|
||||
root: rpid!,
|
||||
pageNum: currentPage + 1,
|
||||
type: replyType.index,
|
||||
);
|
||||
if (res['status']) {
|
||||
res['data'] = ReplyData.fromJson(res['data']);
|
||||
if (res['data'].replies.isNotEmpty) {
|
||||
currentPage = currentPage + 1;
|
||||
noMore.value = false;
|
||||
} else {
|
||||
if (currentPage == 0) {
|
||||
} else {
|
||||
noMore.value = true;
|
||||
return;
|
||||
List<ReplyItemModel> replies = res['data'].replies;
|
||||
if (replies.isNotEmpty) {
|
||||
noMore.value = '加载中...';
|
||||
if (replyList.length == res['data'].page.count) {
|
||||
noMore.value = '没有更多了';
|
||||
}
|
||||
} else {
|
||||
// 未登录状态replies可能返回null
|
||||
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
|
||||
}
|
||||
if (res['data'].replies.length >= res['data'].page.count) {
|
||||
noMore.value = true;
|
||||
}
|
||||
currentPage++;
|
||||
if (type == 'init') {
|
||||
List<ReplyItemModel> replies = res['data'].replies;
|
||||
// List<ReplyItemModel> replies = res['data'].replies;
|
||||
// 添加置顶回复
|
||||
// if (res['data'].upper.top != null) {
|
||||
// bool flag = false;
|
||||
@ -71,12 +69,12 @@ class VideoReplyReplyController extends GetxController {
|
||||
// replies.insert(0, res['data'].upper.top);
|
||||
// }
|
||||
// }
|
||||
replies.insertAll(0, res['data'].topReplies);
|
||||
res['data'].replies = replies;
|
||||
replyList.value = res['data'].replies!;
|
||||
// replies.insertAll(0, res['data'].topReplies);
|
||||
// res['data'].replies = replies;
|
||||
replyList.value = replies;
|
||||
} else {
|
||||
replyList.addAll(res['data'].replies!);
|
||||
res['data'].replies.addAll(replyList);
|
||||
replyList.addAll(replies);
|
||||
// res['data'].replies.addAll(replyList);
|
||||
}
|
||||
}
|
||||
isLoadingMore = false;
|
||||
|
||||
@ -85,12 +85,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const Text('评论详情'),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: () {
|
||||
_videoReplyReplyController.currentPage = 0;
|
||||
widget.closePanel!();
|
||||
@ -115,7 +112,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
controller: _videoReplyReplyController.scrollController,
|
||||
slivers: <Widget>[
|
||||
if (widget.firstFloor != null) ...[
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 10)),
|
||||
// const SliverToBoxAdapter(child: SizedBox(height: 10)),
|
||||
SliverToBoxAdapter(
|
||||
child: ReplyItem(
|
||||
replyItem: widget.firstFloor,
|
||||
@ -160,10 +157,16 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
100,
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Text(_videoReplyReplyController
|
||||
.noMore.value
|
||||
? '没有更多了'
|
||||
: '加载中'),
|
||||
() => Text(
|
||||
_videoReplyReplyController
|
||||
.noMore.value,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user