mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-30 23:29:47 +08:00
@@ -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,
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user