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

@@ -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,
),
};
}

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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),

View File

@@ -61,7 +61,7 @@ class LiveSearchUserItem extends StatelessWidget {
style: style,
),
],
)
),
],
),
),