mod: add skeleton

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-20 21:37:44 +08:00
parent abdde1f811
commit 95caf111ae
24 changed files with 740 additions and 347 deletions

View File

@@ -34,7 +34,14 @@ class _FavArticlePageState extends State<FavArticlePage>
},
child: CustomScrollView(
slivers: [
Obx(() => _buildBody(_favArticleController.loadingState.value)),
SliverPadding(
padding: EdgeInsets.only(
top: StyleString.safeSpace - 5,
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
sliver:
Obx(() => _buildBody(_favArticleController.loadingState.value)),
),
],
),
);
@@ -52,35 +59,29 @@ class _FavArticlePageState extends State<FavArticlePage>
),
),
Success() => loadingState.response?.isNotEmpty == true
? SliverPadding(
padding: EdgeInsets.only(
top: StyleString.safeSpace - 5,
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
sliver: SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == loadingState.response!.length - 1) {
_favArticleController.onLoadMore();
}
return FavArticleItem(
item: loadingState.response![index],
onDelete: () {
showConfirmDialog(
context: context,
title: '确定取消收藏?',
onConfirm: () {
_favArticleController.onRemove(
index,
loadingState.response![index]['opus_id'],
);
});
},
);
},
childCount: loadingState.response!.length,
),
? SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == loadingState.response!.length - 1) {
_favArticleController.onLoadMore();
}
return FavArticleItem(
item: loadingState.response![index],
onDelete: () {
showConfirmDialog(
context: context,
title: '确定取消收藏?',
onConfirm: () {
_favArticleController.onRemove(
index,
loadingState.response![index]['opus_id'],
);
});
},
);
},
childCount: loadingState.response!.length,
),
)
: HttpError(callback: _favArticleController.onReload),

View File

@@ -1,4 +1,4 @@
import 'package:PiliPlus/common/skeleton/video_card_h.dart';
import 'package:PiliPlus/common/skeleton/fav_pgc_item.dart';
import 'package:PiliPlus/common/widgets/dialog.dart';
import 'package:PiliPlus/common/widgets/http_error.dart';
import 'package:PiliPlus/common/widgets/icon_button.dart';
@@ -162,7 +162,7 @@ class _FavPgcChildPageState extends State<FavPgcChildPage>
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
(context, index) {
return const VideoCardHSkeleton();
return const FavPgcItemSkeleton();
},
childCount: 10,
),

View File

@@ -37,8 +37,14 @@ class _FavVideoPageState extends State<FavVideoPage>
controller: _favController.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
Obx(
() => _buildBody(_favController.loadingState.value),
SliverPadding(
padding: EdgeInsets.only(
top: StyleString.safeSpace - 5,
bottom: 80 + MediaQuery.paddingOf(context).bottom,
),
sliver: Obx(
() => _buildBody(_favController.loadingState.value),
),
),
],
),
@@ -57,44 +63,38 @@ class _FavVideoPageState extends State<FavVideoPage>
),
),
Success() => loadingState.response?.isNotEmpty == true
? SliverPadding(
padding: EdgeInsets.only(
top: StyleString.safeSpace - 5,
bottom: 80 + MediaQuery.paddingOf(context).bottom,
),
sliver: SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
childCount: loadingState.response!.length,
(BuildContext context, int index) {
if (index == loadingState.response!.length - 1) {
_favController.onLoadMore();
}
final item = loadingState.response![index];
String heroTag = Utils.makeHeroTag(item.fid);
return FavItem(
heroTag: heroTag,
favFolderItem: item,
onTap: () async {
dynamic res = await Get.toNamed(
'/favDetail',
arguments: item,
parameters: {
'heroTag': heroTag,
'mediaId': item.id.toString(),
},
);
if (res == true) {
List<FavFolderItemData> list =
(_favController.loadingState.value as Success)
.response;
list.removeAt(index);
_favController.loadingState.refresh();
}
},
);
},
),
? SliverGrid(
gridDelegate: Grid.videoCardHDelegate(context),
delegate: SliverChildBuilderDelegate(
childCount: loadingState.response!.length,
(BuildContext context, int index) {
if (index == loadingState.response!.length - 1) {
_favController.onLoadMore();
}
final item = loadingState.response![index];
String heroTag = Utils.makeHeroTag(item.fid);
return FavItem(
heroTag: heroTag,
favFolderItem: item,
onTap: () async {
dynamic res = await Get.toNamed(
'/favDetail',
arguments: item,
parameters: {
'heroTag': heroTag,
'mediaId': item.id.toString(),
},
);
if (res == true) {
List<FavFolderItemData> list =
(_favController.loadingState.value as Success)
.response;
list.removeAt(index);
_favController.loadingState.refresh();
}
},
);
},
),
)
: HttpError(