Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-16 10:52:39 +08:00
parent 2090fd2312
commit 55733d30c5
86 changed files with 1359 additions and 1740 deletions

View File

@@ -26,7 +26,7 @@ class FavPgcChildPage extends StatefulWidget {
}
class _FavPgcChildPageState extends State<FavPgcChildPage>
with AutomaticKeepAliveClientMixin {
with AutomaticKeepAliveClientMixin, GridMixin {
late final FavPgcController _favPgcController = Get.put(
FavPgcController(widget.type, widget.followStatus),
tag: '${widget.type}${widget.followStatus}',
@@ -165,52 +165,46 @@ class _FavPgcChildPageState extends State<FavPgcChildPage>
Widget _buildBody(LoadingState<List<FavPgcItemModel>?> loadingState) {
return switch (loadingState) {
Loading() => SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const FavPgcItemSkeleton();
},
childCount: 10,
),
Loading() => SliverGrid.builder(
gridDelegate: gridDelegate,
itemBuilder: (context, index) => const FavPgcItemSkeleton(),
itemCount: 10,
),
Success(:var response) =>
response?.isNotEmpty == true
? SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == response.length - 1) {
_favPgcController.onLoadMore();
}
final item = response[index];
return FavPgcItem(
item: item,
ctr: _favPgcController,
onSelect: () => _favPgcController.onSelect(item),
onUpdateStatus: () => showPgcFollowDialog(
context: context,
type: widget.type == 0 ? '追番' : '追剧',
followStatus: widget.followStatus,
onUpdateStatus: (followStatus) {
if (followStatus == -1) {
_favPgcController.pgcDel(
index,
item.seasonId,
);
} else {
_favPgcController.onUpdate(
index,
followStatus,
item.seasonId,
);
}
},
),
);
},
childCount: response!.length,
),
? SliverGrid.builder(
gridDelegate: gridDelegate,
itemBuilder: (context, index) {
if (index == response.length - 1) {
_favPgcController.onLoadMore();
}
final item = response[index];
return FavPgcItem(
item: item,
ctr: _favPgcController,
onSelect: () => _favPgcController.onSelect(item),
onUpdateStatus: () => showPgcFollowDialog(
context: context,
type: widget.type == 0 ? '追番' : '追剧',
followStatus: widget.followStatus,
onUpdateStatus: (followStatus) {
if (followStatus == -1) {
_favPgcController.pgcDel(
index,
item.seasonId,
);
} else {
_favPgcController.onUpdate(
index,
followStatus,
item.seasonId,
);
}
},
),
);
},
itemCount: response!.length,
)
: HttpError(onReload: _favPgcController.onReload),
Error(:var errMsg) => HttpError(