fix(recommend): 固定全部短剧筛选区并统一间距

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:43:15 +08:00
1 parent 099d05064e
commit e147002e00
4 files changed
+144 -64

No files matched your search

+2 -2
View File
@@ -137,9 +137,9 @@ abstract final class AppDimens {
static const double recommendCardWidth = 122;
/// 全部短剧筛选与追剧双列。
static const double filterChipFont = 13;
static const double filterChipFont = 15;
static const double filterChipHeight = 28;
static const double filterChipRadius = 14;
static const double filterChipRadius = 15;
static const double filterChipHorizontalPadding = 12;
static const double filterRowGap = 8;
static const double filterItemGap = 24;
@@ -55,72 +55,84 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
final itemExtent =
itemWidth / AppDimens.cardCoverAspectRatio +
AppDimens.homeCardBodyExtent;
return NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: AppPullToRefresh(
key: const Key('all-dramas-refresh'),
onRefresh: () async {
await widget.feedController.refreshCurrent();
},
child: CustomScrollView(
key: const Key('all-dramas-scroll'),
physics: AppPullToRefresh.physics,
slivers: [
SliverToBoxAdapter(child: _filters(l10n)),
if (dramas.isEmpty)
SliverFillRemaining(
hasScrollBody: false,
child: EmptyState(
key: const Key('all-dramas-empty'),
icon: Icons.movie_filter_outlined,
title: l10n.homeGridFilterEmpty,
actionLabel: l10n.homeGridClearFilter,
onAction: () => setState(() {
_region = 'all';
_audio = 'all';
_genre = null;
}),
),
)
else
SliverPadding(
padding: const EdgeInsets.symmetric(
horizontal: AppDimens.allDramasHorizontal,
),
sliver: SliverGrid(
key: const Key('all-dramas-grid'),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: AppDimens.allDramasGridGap,
mainAxisSpacing: AppDimens.allDramasGridRowGap,
mainAxisExtent: itemExtent,
),
delegate: SliverChildBuilderDelegate(
(context, index) => HomeFeedCard(
drama: dramas[index],
onTap: () => widget.onOpenDrama(dramas[index]),
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_filters(l10n),
Expanded(
child: NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: AppPullToRefresh(
key: const Key('all-dramas-refresh'),
onRefresh: () async {
await widget.feedController.refreshCurrent();
},
child: CustomScrollView(
key: const Key('all-dramas-scroll'),
physics: AppPullToRefresh.physics,
slivers: [
if (dramas.isEmpty)
SliverFillRemaining(
hasScrollBody: false,
child: EmptyState(
key: const Key('all-dramas-empty'),
icon: Icons.movie_filter_outlined,
title: l10n.homeGridFilterEmpty,
actionLabel: l10n.homeGridClearFilter,
onAction: () => setState(() {
_region = 'all';
_audio = 'all';
_genre = null;
}),
),
)
else
SliverPadding(
padding: const EdgeInsets.symmetric(
horizontal: AppDimens.allDramasHorizontal,
),
sliver: SliverGrid(
key: const Key('all-dramas-grid'),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: AppDimens.allDramasGridGap,
mainAxisSpacing:
AppDimens.allDramasGridRowGap,
mainAxisExtent: itemExtent,
),
delegate: SliverChildBuilderDelegate(
(context, index) => HomeFeedCard(
drama: dramas[index],
onTap: () => widget.onOpenDrama(dramas[index]),
),
childCount: dramas.length,
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(
bottom: AppDimens.spaceXl,
),
child: PagedListFooter(
loading: widget.feedController.loadingMore,
hasMore: widget.feedController.hasMore,
hasItems: dramas.isNotEmpty,
errorMessage:
widget.feedController.lastError == null
? null
: l10n.catalogError,
onRetry: widget.feedController.loadMore,
),
),
childCount: dramas.length,
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(bottom: AppDimens.spaceXl),
child: PagedListFooter(
loading: widget.feedController.loadingMore,
hasMore: widget.feedController.hasMore,
hasItems: dramas.isNotEmpty,
errorMessage: widget.feedController.lastError == null
? null
: l10n.catalogError,
onRetry: widget.feedController.loadMore,
),
],
),
),
],
),
),
),
],
);
},
);
@@ -304,7 +316,11 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
onTap: onTap,
child: SizedBox(
height: AppDimens.filterChipHeight,
child: Center(
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: AppDimens.filterChipHorizontalPadding,
),
alignment: Alignment.center,
child: Text(
label,
style: TextStyle(