feat(recommend): 新增分区流全部短剧与剧单
This commit is contained in:
1 parent
0ef2438100
commit
f1b5418954
22 files changed
+1426
-722
No files matched your search
@@ -34,7 +34,9 @@ const Color _bronzeEnd = AppColors.bronzeDeep;
|
||||
|
||||
/// 剧场榜单页:前三名横排领奖台,第 4 名起纵向列表。
|
||||
class RankingPage extends StatefulWidget {
|
||||
const RankingPage({super.key});
|
||||
const RankingPage({super.key, this.embedded = false});
|
||||
|
||||
final bool embedded;
|
||||
|
||||
@override
|
||||
State<RankingPage> createState() => _RankingPageState();
|
||||
@@ -109,63 +111,71 @@ class _RankingPageState extends State<RankingPage> {
|
||||
final top = pager.visibleItems;
|
||||
final podium = top.take(3).toList();
|
||||
final rest = top.skip(3).toList();
|
||||
final content = NotificationListener<ScrollNotification>(
|
||||
onNotification: _onScroll,
|
||||
child: AppPullToRefresh(
|
||||
key: const Key('ranking-refresh'),
|
||||
onRefresh: _refresh,
|
||||
child: ListView(
|
||||
key: const Key('ranking-list'),
|
||||
controller: _scroll,
|
||||
physics: AppPullToRefresh.physics,
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 24),
|
||||
children: top.isEmpty
|
||||
? [
|
||||
SizedBox(
|
||||
height: 420,
|
||||
child: EmptyState(
|
||||
icon: Icons.leaderboard_outlined,
|
||||
title: l10n.noStories,
|
||||
),
|
||||
),
|
||||
]
|
||||
: [
|
||||
if (podium.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: _Podium(podium: podium, l10n: l10n),
|
||||
),
|
||||
if (rest.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
for (var index = 0; index < rest.length; index++) ...[
|
||||
if (index > 0) const SizedBox(height: _rowGap),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: _RankingRow(
|
||||
index: index + 3,
|
||||
drama: rest[index],
|
||||
l10n: l10n,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
PagedLoadFooter(
|
||||
loading: pager.loading,
|
||||
hasMore: pager.hasMore,
|
||||
hasItems: pager.items.isNotEmpty,
|
||||
loadMoreKey: const Key('ranking-load-more'),
|
||||
noMoreKey: const Key('ranking-no-more'),
|
||||
noMoreLabel: l10n.noMore,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
if (widget.embedded) {
|
||||
return ColoredBox(
|
||||
key: const Key('ranking-page'),
|
||||
color: AppColors.appBackground,
|
||||
child: SafeArea(bottom: false, child: content),
|
||||
);
|
||||
}
|
||||
return PlainPageScaffold(
|
||||
pageKey: const Key('ranking-page'),
|
||||
backKey: const Key('ranking-back'),
|
||||
title: l10n.topCharts,
|
||||
subtitle: l10n.rankingSubtitle,
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: _onScroll,
|
||||
child: AppPullToRefresh(
|
||||
key: const Key('ranking-refresh'),
|
||||
onRefresh: _refresh,
|
||||
child: ListView(
|
||||
key: const Key('ranking-list'),
|
||||
controller: _scroll,
|
||||
physics: AppPullToRefresh.physics,
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 24),
|
||||
children: top.isEmpty
|
||||
? [
|
||||
SizedBox(
|
||||
height: 420,
|
||||
child: EmptyState(
|
||||
icon: Icons.leaderboard_outlined,
|
||||
title: l10n.noStories,
|
||||
),
|
||||
),
|
||||
]
|
||||
: [
|
||||
if (podium.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: _Podium(podium: podium, l10n: l10n),
|
||||
),
|
||||
if (rest.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
for (var index = 0; index < rest.length; index++) ...[
|
||||
if (index > 0) const SizedBox(height: _rowGap),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: _RankingRow(
|
||||
index: index + 3,
|
||||
drama: rest[index],
|
||||
l10n: l10n,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
PagedLoadFooter(
|
||||
loading: pager.loading,
|
||||
hasMore: pager.hasMore,
|
||||
hasItems: pager.items.isNotEmpty,
|
||||
loadMoreKey: const Key('ranking-load-more'),
|
||||
noMoreKey: const Key('ranking-no-more'),
|
||||
noMoreLabel: l10n.noMore,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user