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

@@ -79,7 +79,9 @@ class LiveController extends CommonListController {
);
}
return LiveHttp.liveFeedIndex(
pn: page, isLogin: accountService.isLogin.value);
pn: page,
isLogin: accountService.isLogin.value,
);
}
@override
@@ -105,10 +107,10 @@ class LiveController extends CommonListController {
first: data.followItem,
second: data.areaItem,
);
areaIndex.value = (data.areaItem?.cardData?.areaEntranceV3?.list
?.indexWhere((e) =>
e.areaV2Id == areaId &&
e.areaV2ParentId == parentAreaId) ??
areaIndex.value =
(data.areaItem?.cardData?.areaEntranceV3?.list?.indexWhere(
(e) => e.areaV2Id == areaId && e.areaV2ParentId == parentAreaId,
) ??
-2) +
1;
}

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

View File

@@ -29,33 +29,35 @@ class LiveCardVApp 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),
),
),
],
);
},
),
),
liveContent(context)
liveContent(context),
],
),
),