feat: 开屏后直接展示首页骨架
This commit is contained in:
1 parent
56d7abc6b1
commit
5f278a3510
10 files changed
+300
-166
No files matched your search
@@ -127,15 +127,7 @@ class _RecommendPageState extends State<RecommendPage> {
|
||||
if (dramas.isEmpty) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
if (widget.feedController.loadingFirstPage) {
|
||||
return const ColoredBox(
|
||||
color: AppColors.mediaBlack,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
key: Key('recommend-feed-loading'),
|
||||
color: AppColors.muted,
|
||||
),
|
||||
),
|
||||
);
|
||||
return const _RecommendFeedSkeleton();
|
||||
}
|
||||
return ColoredBox(
|
||||
color: AppColors.mediaBlack,
|
||||
@@ -259,6 +251,68 @@ class _RecommendPageState extends State<RecommendPage> {
|
||||
}
|
||||
}
|
||||
|
||||
class _RecommendFeedSkeleton extends StatelessWidget {
|
||||
const _RecommendFeedSkeleton();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const ColoredBox(
|
||||
key: Key('recommend-feed-skeleton'),
|
||||
color: AppColors.mediaBlack,
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 132,
|
||||
height: 176,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.skeletonSurface,
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 14,
|
||||
right: 72,
|
||||
bottom: 42,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_SkeletonLine(width: 190, height: 18),
|
||||
SizedBox(height: 10),
|
||||
_SkeletonLine(width: 140, height: 12),
|
||||
SizedBox(height: 8),
|
||||
_SkeletonLine(width: 220, height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SkeletonLine extends StatelessWidget {
|
||||
const _SkeletonLine({required this.width, required this.height});
|
||||
|
||||
final double width;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.skeletonSurface,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _KeepAliveTab extends StatefulWidget {
|
||||
const _KeepAliveTab({super.key, required this.child});
|
||||
|
||||
|
||||
Reference in new issue
Block a user