Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-23 16:47:11 +08:00
parent 148e0872b4
commit 418a1e8d39
821 changed files with 29467 additions and 25520 deletions

View File

@@ -151,14 +151,16 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
),
),
),
)
),
],
),
),
),
),
Obx(() =>
_buildBody(theme, _videoReplyController.loadingState.value)),
Obx(
() =>
_buildBody(theme, _videoReplyController.loadingState.value),
),
],
),
Positioned(
@@ -189,66 +191,67 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
Widget _buildBody(ThemeData theme, LoadingState loadingState) {
return switch (loadingState) {
Loading() => SliverList.builder(
itemBuilder: (BuildContext context, index) {
return const VideoReplySkeleton();
},
itemCount: 5,
),
Success(:var response) => response?.isNotEmpty == true
? SliverList.builder(
itemBuilder: (context, index) {
double bottom = MediaQuery.paddingOf(context).bottom;
if (index == response.length) {
_videoReplyController.onLoadMore();
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: bottom),
height: bottom + 100,
child: Text(
_videoReplyController.isEnd ? '没有更多了' : '加载中...',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
itemBuilder: (BuildContext context, index) {
return const VideoReplySkeleton();
},
itemCount: 5,
),
Success(:var response) =>
response?.isNotEmpty == true
? SliverList.builder(
itemBuilder: (context, index) {
double bottom = MediaQuery.paddingOf(context).bottom;
if (index == response.length) {
_videoReplyController.onLoadMore();
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: bottom),
height: bottom + 100,
child: Text(
_videoReplyController.isEnd ? '没有更多了' : '加载中...',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
),
),
),
);
} else {
return ReplyItemGrpc(
replyItem: response[index],
replyLevel: widget.replyLevel,
replyReply: widget.replyReply,
onReply: (replyItem) => _videoReplyController.onReply(
context,
replyItem: replyItem,
),
onDelete: (item, subIndex) =>
_videoReplyController.onRemove(index, item, subIndex),
upMid: _videoReplyController.upMid,
getTag: () => heroTag,
onViewImage: widget.onViewImage,
onDismissed: widget.onDismissed,
callback: widget.callback,
onCheckReply: (item) => _videoReplyController
.onCheckReply(item, isManual: true),
onToggleTop: (item) => _videoReplyController.onToggleTop(
item,
index,
_videoReplyController.aid,
1,
),
);
}
},
itemCount: response.length + 1,
)
: HttpError(
errMsg: '还没有评论',
onReload: _videoReplyController.onReload,
),
);
} else {
return ReplyItemGrpc(
replyItem: response[index],
replyLevel: widget.replyLevel,
replyReply: widget.replyReply,
onReply: (replyItem) => _videoReplyController.onReply(
context,
replyItem: replyItem,
),
onDelete: (item, subIndex) =>
_videoReplyController.onRemove(index, item, subIndex),
upMid: _videoReplyController.upMid,
getTag: () => heroTag,
onViewImage: widget.onViewImage,
onDismissed: widget.onDismissed,
callback: widget.callback,
onCheckReply: (item) => _videoReplyController
.onCheckReply(item, isManual: true),
onToggleTop: (item) => _videoReplyController.onToggleTop(
item,
index,
_videoReplyController.aid,
1,
),
);
}
},
itemCount: response.length + 1,
)
: HttpError(
errMsg: '还没有评论',
onReload: _videoReplyController.onReload,
),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: _videoReplyController.onReload,
),
errMsg: errMsg,
onReload: _videoReplyController.onReload,
),
};
}
}