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