opt: common ctr

opt: state

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-11 12:21:42 +08:00
parent 5bff1747e6
commit 574bf861f0
129 changed files with 1065 additions and 1058 deletions

View File

@@ -544,11 +544,11 @@ class _ArticlePageState extends State<ArticlePage>
return const VideoReplySkeleton();
},
),
Success() => loadingState.response?.isNotEmpty == true
Success(:var response) => response?.isNotEmpty == true
? SliverList.builder(
itemCount: loadingState.response!.length + 1,
itemCount: response!.length + 1,
itemBuilder: (context, index) {
if (index == loadingState.response!.length) {
if (index == response.length) {
_articleCtr.onLoadMore();
return Container(
alignment: Alignment.center,
@@ -556,11 +556,7 @@ class _ArticlePageState extends State<ArticlePage>
bottom: MediaQuery.of(context).padding.bottom),
height: 125,
child: Text(
_articleCtr.isEnd.not
? '加载中...'
: loadingState.response!.isEmpty
? '还没有评论'
: '没有更多了',
_articleCtr.isEnd.not ? '加载中...' : '没有更多了',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
@@ -569,14 +565,14 @@ class _ArticlePageState extends State<ArticlePage>
);
} else {
return ReplyItemGrpc(
replyItem: loadingState.response![index],
replyItem: response[index],
replyLevel: '1',
replyReply: (replyItem, id) =>
replyReply(context, replyItem, id),
onReply: () {
_articleCtr.onReply(
context,
replyItem: loadingState.response![index],
replyItem: response[index],
index: index,
);
},
@@ -597,11 +593,9 @@ class _ArticlePageState extends State<ArticlePage>
}
},
)
: HttpError(
onReload: _articleCtr.onReload,
),
Error() => HttpError(
errMsg: loadingState.errMsg,
: HttpError(onReload: _articleCtr.onReload),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: _articleCtr.onReload,
),
};