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

@@ -54,10 +54,12 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
top: StyleString.cardSpace,
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
sliver: SliverMainAxisGroup(slivers: [
Obx(() => _buildTop(theme, controller.topState.value)),
Obx(() => _buildBody(theme, controller.loadingState.value)),
]),
sliver: SliverMainAxisGroup(
slivers: [
Obx(() => _buildTop(theme, controller.topState.value)),
Obx(() => _buildBody(theme, controller.loadingState.value)),
],
),
),
],
),
@@ -77,11 +79,17 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
Expanded(
child: SelfSizedHorizontalList(
gapSize: 12,
padding:
const EdgeInsets.only(top: 10, bottom: 10, right: 12),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
right: 12,
),
childBuilder: (index) {
late final item = data
.second!.cardData!.areaEntranceV3!.list![index - 1];
.second!
.cardData!
.areaEntranceV3!
.list![index - 1];
return Obx(
() {
final isCurr = index == controller.areaIndex.value;
@@ -132,91 +140,90 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
Widget _buildBody(ThemeData theme, LoadingState<List?> loadingState) {
return switch (loadingState) {
Loading() => 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,
),
),
Success(:var response) => SliverMainAxisGroup(
slivers: [
if (controller.newTags?.isNotEmpty == true)
SliverToBoxAdapter(
child: SelfSizedHorizontalList(
gapSize: 12,
padding: const EdgeInsets.only(bottom: 8),
childBuilder: (index) {
late final item = controller.newTags![index];
return Obx(
() {
final isCurr = index == controller.tagIndex.value;
return SearchText(
fontSize: 13,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
text: '${item.name}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectTag(
index,
item.sortType,
);
},
);
},
);
},
itemCount: controller.newTags!.length,
),
),
response?.isNotEmpty == true
? 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) {
if (index == response.length - 1) {
controller.onLoadMore();
}
final item = response[index];
if (item is LiveCardList) {
return LiveCardVApp(
item: item.cardData!.smallCardV1!,
slivers: [
if (controller.newTags?.isNotEmpty == true)
SliverToBoxAdapter(
child: SelfSizedHorizontalList(
gapSize: 12,
padding: const EdgeInsets.only(bottom: 8),
childBuilder: (index) {
late final item = controller.newTags![index];
return Obx(
() {
final isCurr = index == controller.tagIndex.value;
return SearchText(
fontSize: 13,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
text: '${item.name}',
bgColor: isCurr
? theme.colorScheme.secondaryContainer
: Colors.transparent,
textColor: isCurr
? theme.colorScheme.onSecondaryContainer
: null,
onTap: (value) {
controller.onSelectTag(
index,
item.sortType,
);
}
return LiveCardVApp(item: item);
},
childCount: response!.length,
),
)
: HttpError(onReload: controller.onReload),
],
),
},
);
},
);
},
itemCount: controller.newTags!.length,
),
),
response?.isNotEmpty == true
? 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) {
if (index == response.length - 1) {
controller.onLoadMore();
}
final item = response[index];
if (item is LiveCardList) {
return LiveCardVApp(
item: item.cardData!.smallCardV1!,
);
}
return LiveCardVApp(item: item);
},
childCount: response!.length,
),
)
: HttpError(onReload: controller.onReload),
],
),
Error(:var errMsg) => HttpError(
errMsg: errMsg,
onReload: controller.onReload,
),
errMsg: errMsg,
onReload: controller.onReload,
),
};
}