mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-25 04:45:54 +08:00
@@ -55,50 +55,52 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
Widget get _buildLoading {
|
||||
return switch (widget.searchType) {
|
||||
LiveSearchType.room => SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(context).scale(90),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return const VideoCardVSkeleton();
|
||||
},
|
||||
childCount: 10,
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(context).scale(90),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return const VideoCardVSkeleton();
|
||||
},
|
||||
childCount: 10,
|
||||
),
|
||||
),
|
||||
LiveSearchType.user => SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
mainAxisExtent: 60,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return const MsgFeedTopSkeleton();
|
||||
},
|
||||
childCount: 12,
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
mainAxisExtent: 60,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return const MsgFeedTopSkeleton();
|
||||
},
|
||||
childCount: 12,
|
||||
),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => _buildLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
LiveSearchType.room => SliverGrid(
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
return switch (widget.searchType) {
|
||||
LiveSearchType.room => SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
childAspectRatio: StyleString.aspectRatio,
|
||||
mainAxisExtent:
|
||||
MediaQuery.textScalerOf(context).scale(60),
|
||||
mainAxisExtent: MediaQuery.textScalerOf(
|
||||
context,
|
||||
).scale(60),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
@@ -112,7 +114,7 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
LiveSearchType.user => SliverGrid(
|
||||
LiveSearchType.user => SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
mainAxisExtent: 60,
|
||||
@@ -129,16 +131,16 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
};
|
||||
},
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
},
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,13 @@ class LiveSearchController extends GetxController
|
||||
final RxList<int> counts = <int>[-1, -1].obs;
|
||||
|
||||
late final roomCtr = Get.put(
|
||||
LiveSearchChildController(this, LiveSearchType.room),
|
||||
tag: Utils.generateRandomString(8));
|
||||
LiveSearchChildController(this, LiveSearchType.room),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
late final userCtr = Get.put(
|
||||
LiveSearchChildController(this, LiveSearchType.user),
|
||||
tag: Utils.generateRandomString(8));
|
||||
LiveSearchChildController(this, LiveSearchType.user),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
void onClear() {
|
||||
if (editingController.value.text.isNotEmpty) {
|
||||
|
||||
@@ -14,8 +14,10 @@ class LiveSearchPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LiveSearchPageState extends State<LiveSearchPage> {
|
||||
final _controller =
|
||||
Get.put(LiveSearchController(), tag: Utils.generateRandomString(8));
|
||||
final _controller = Get.put(
|
||||
LiveSearchController(),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -28,7 +30,7 @@ class _LiveSearchPageState extends State<LiveSearchPage> {
|
||||
onPressed: _controller.submit,
|
||||
icon: const Icon(Icons.search, size: 22),
|
||||
),
|
||||
const SizedBox(width: 10)
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
title: TextField(
|
||||
autofocus: true,
|
||||
|
||||
@@ -30,31 +30,33 @@ class LiveCardVSearch extends StatelessWidget {
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: item.cover!,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
radius: 0,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: AnimatedOpacity(
|
||||
opacity: 1,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: videoStat(context),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: item.cover!,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
radius: 0,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: AnimatedOpacity(
|
||||
opacity: 1,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: videoStat(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||
|
||||
@@ -61,7 +61,7 @@ class LiveSearchUserItem extends StatelessWidget {
|
||||
style: style,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user