mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user