mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
opt: common ctr
opt: state Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -47,7 +47,7 @@ class LiveSearchChildController
|
||||
Future<LoadingState<LiveSearchData>> customGetData() {
|
||||
return LiveHttp.liveSearch(
|
||||
isLogin: isLogin,
|
||||
page: currentPage,
|
||||
page: page,
|
||||
keyword: controller.editingController.text,
|
||||
type: searchType,
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
Widget _buildBody(LoadingState<List?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => _buildLoading,
|
||||
Success() => loadingState.response?.isNotEmpty == true
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
@@ -106,14 +106,14 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
if (index == loadingState.response!.length - 1) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return LiveCardVSearch(
|
||||
item: loadingState.response![index],
|
||||
item: response[index],
|
||||
);
|
||||
},
|
||||
childCount: loadingState.response!.length,
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
LiveSearchType.user => SliverGrid(
|
||||
@@ -123,14 +123,14 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
if (index == loadingState.response!.length - 1) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return LiveSearchUserItem(
|
||||
item: loadingState.response![index],
|
||||
item: response[index],
|
||||
);
|
||||
},
|
||||
childCount: loadingState.response!.length,
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
};
|
||||
@@ -139,8 +139,8 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
Error() => HttpError(
|
||||
errMsg: loadingState.errMsg,
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user