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

@@ -65,27 +65,28 @@ class _ReplySearchChildPageState extends State<ReplySearchChildPage>
Widget _buildBody(LoadingState<List<SearchItem>?> loadingState) {
return switch (loadingState) {
Loading() => _buildLoading,
Success(:var response) => response?.isNotEmpty == true
? SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == response.length - 1) {
_controller.onLoadMore();
}
return ReplySearchItem(
item: response[index],
type: widget.searchType,
);
},
childCount: response!.length,
),
)
: HttpError(onReload: _controller.onReload),
Success(:var response) =>
response?.isNotEmpty == true
? SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == response.length - 1) {
_controller.onLoadMore();
}
return ReplySearchItem(
item: response[index],
type: widget.searchType,
);
},
childCount: response!.length,
),
)
: HttpError(onReload: _controller.onReload),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: _controller.onReload,
),
errMsg: errMsg,
onReload: _controller.onReload,
),
};
}

View File

@@ -16,11 +16,13 @@ class ReplySearchController extends GetxController
final focusNode = FocusNode();
late final videoCtr = Get.put(
ReplySearchChildController(this, ReplySearchType.video),
tag: Utils.generateRandomString(8));
ReplySearchChildController(this, ReplySearchType.video),
tag: Utils.generateRandomString(8),
);
late final articleCtr = Get.put(
ReplySearchChildController(this, ReplySearchType.article),
tag: Utils.generateRandomString(8));
ReplySearchChildController(this, ReplySearchType.article),
tag: Utils.generateRandomString(8),
);
void onClear() {
if (editingController.value.text.isNotEmpty) {

View File

@@ -22,8 +22,9 @@ class ReplySearchPage extends StatefulWidget {
class _ReplySearchPageState extends State<ReplySearchPage> {
late final _controller = Get.put(
ReplySearchController(widget.type, widget.oid),
tag: Utils.generateRandomString(8));
ReplySearchController(widget.type, widget.oid),
tag: Utils.generateRandomString(8),
);
@override
Widget build(BuildContext context) {
@@ -35,7 +36,7 @@ class _ReplySearchPageState extends State<ReplySearchPage> {
onPressed: _controller.submit,
icon: const Icon(Icons.search, size: 22),
),
const SizedBox(width: 10)
const SizedBox(width: 10),
],
title: TextField(
autofocus: true,