mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-24 18:18:38 +00:00
@@ -59,17 +59,17 @@ class MemberSearchChildController extends CommonListController {
|
||||
Future<LoadingState> customGetData() {
|
||||
return switch (searchType) {
|
||||
MemberSearchType.archive => MemberHttp.searchArchive(
|
||||
mid: controller.mid,
|
||||
pn: page,
|
||||
keyword: controller.editingController.text,
|
||||
order: 'pubdate',
|
||||
),
|
||||
mid: controller.mid,
|
||||
pn: page,
|
||||
keyword: controller.editingController.text,
|
||||
order: 'pubdate',
|
||||
),
|
||||
MemberSearchType.dynamic => MemberHttp.dynSearch(
|
||||
mid: controller.mid,
|
||||
pn: page,
|
||||
offset: offset ?? '',
|
||||
keyword: controller.editingController.text,
|
||||
),
|
||||
mid: controller.mid,
|
||||
pn: page,
|
||||
offset: offset ?? '',
|
||||
keyword: controller.editingController.text,
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,27 +56,29 @@ class _MemberSearchChildPageState extends State<MemberSearchChildPage>
|
||||
Widget get _buildLoading {
|
||||
return switch (widget.searchType) {
|
||||
MemberSearchType.archive => SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
childCount: 10,
|
||||
),
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
childCount: 10,
|
||||
),
|
||||
MemberSearchType.dynamic =>
|
||||
DynamicsTabPage.dynSkeleton(GlobalData().dynamicsWaterfallFlow),
|
||||
),
|
||||
MemberSearchType.dynamic => DynamicsTabPage.dynSkeleton(
|
||||
GlobalData().dynamicsWaterfallFlow,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => _buildLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
MemberSearchType.archive => SliverGrid(
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
MemberSearchType.archive => SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
@@ -90,53 +92,54 @@ class _MemberSearchChildPageState extends State<MemberSearchChildPage>
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
MemberSearchType.dynamic => GlobalData().dynamicsWaterfallFlow
|
||||
? SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return index == response.length
|
||||
? LastChildLayoutType.foot
|
||||
: LastChildLayoutType.none;
|
||||
},
|
||||
children: response!
|
||||
.map((item) => DynamicPanel(item: item))
|
||||
.toList(),
|
||||
)
|
||||
: SliverCrossAxisGroup(
|
||||
slivers: [
|
||||
const SliverFillRemaining(),
|
||||
SliverConstrainedCrossAxis(
|
||||
maxExtent: Grid.smallCardWidth * 2,
|
||||
sliver: SliverList.builder(
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return DynamicPanel(
|
||||
item: response[index],
|
||||
);
|
||||
},
|
||||
itemCount: response!.length,
|
||||
),
|
||||
MemberSearchType.dynamic =>
|
||||
GlobalData().dynamicsWaterfallFlow
|
||||
? SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return index == response.length
|
||||
? LastChildLayoutType.foot
|
||||
: LastChildLayoutType.none;
|
||||
},
|
||||
children: response!
|
||||
.map((item) => DynamicPanel(item: item))
|
||||
.toList(),
|
||||
)
|
||||
: SliverCrossAxisGroup(
|
||||
slivers: [
|
||||
const SliverFillRemaining(),
|
||||
SliverConstrainedCrossAxis(
|
||||
maxExtent: Grid.smallCardWidth * 2,
|
||||
sliver: SliverList.builder(
|
||||
itemBuilder: (context, index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return DynamicPanel(
|
||||
item: response[index],
|
||||
);
|
||||
},
|
||||
itemCount: response!.length,
|
||||
),
|
||||
),
|
||||
const SliverFillRemaining(),
|
||||
],
|
||||
),
|
||||
const SliverFillRemaining(),
|
||||
],
|
||||
),
|
||||
};
|
||||
},
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
},
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,13 @@ class MemberSearchController extends GetxController
|
||||
final RxList<int> counts = <int>[-1, -1].obs;
|
||||
|
||||
late final arcCtr = Get.put(
|
||||
MemberSearchChildController(this, MemberSearchType.archive),
|
||||
tag: Utils.generateRandomString(8));
|
||||
MemberSearchChildController(this, MemberSearchType.archive),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
late final dynCtr = Get.put(
|
||||
MemberSearchChildController(this, MemberSearchType.dynamic),
|
||||
tag: Utils.generateRandomString(8));
|
||||
MemberSearchChildController(this, MemberSearchType.dynamic),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
void onClear() {
|
||||
if (editingController.value.text.isNotEmpty) {
|
||||
|
||||
@@ -14,8 +14,10 @@ class MemberSearchPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MemberSearchPageState extends State<MemberSearchPage> {
|
||||
final _controller =
|
||||
Get.put(MemberSearchController(), tag: Utils.generateRandomString(8));
|
||||
final _controller = Get.put(
|
||||
MemberSearchController(),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -28,7 +30,7 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
|
||||
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