feat(ui): 更新品牌启动页与选集交互

This commit is contained in:
Zhou Weidong committed 2026-10-19 09:28:16 +08:00
1 parent 4778ce2c75
commit c1cb7d1c11
87 files changed
+919 -552

No files matched your search

+82 -58
View File
@@ -16,28 +16,20 @@ class _HomeDramaGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (categories.loading && categories.feed.sections.isEmpty) {
return const SliverPadding(
padding: EdgeInsets.symmetric(vertical: 24),
sliver: SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
),
return const SliverFillRemaining(
hasScrollBody: false,
child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
);
}
if (categories.error != null) {
return SliverPadding(
padding: const EdgeInsets.fromLTRB(16, 6, 16, 18),
sliver: SliverToBoxAdapter(
child: Row(
children: [
Expanded(
child: Text(
l10n.categoriesError,
style: const TextStyle(color: AppColors.muted),
),
),
TextButton(onPressed: categories.load, child: Text(l10n.retry)),
],
),
return _fill(
EmptyState(
key: const Key('home-categories-error'),
icon: Icons.cloud_off_rounded,
title: l10n.categoriesError,
subtitle: l10n.emptyHint,
actionLabel: l10n.retry,
onAction: categories.load,
),
);
}
@@ -45,45 +37,51 @@ class _HomeDramaGrid extends StatelessWidget {
final dramas = categories.visibleDramas;
if (dramas.isEmpty) {
final missingCategory = categories.selectedSectionMissing;
return SliverPadding(
padding: const EdgeInsets.fromLTRB(16, 6, 16, 24),
sliver: SliverToBoxAdapter(
child: EmptyState(
key: const Key('home-all-dramas-empty'),
icon: missingCategory
? Icons.grid_view_rounded
: Icons.search_off_rounded,
title: missingCategory
? l10n.noCategoryDramas
: l10n.noSearchResults,
subtitle: l10n.emptyHint,
),
return _fill(
EmptyState(
key: const Key('home-all-dramas-empty'),
icon: missingCategory
? Icons.grid_view_rounded
: Icons.search_off_rounded,
title: missingCategory ? l10n.noCategoryDramas : l10n.noSearchResults,
subtitle: l10n.emptyHint,
),
);
}
return SliverPadding(
key: const Key('home-all-dramas-section'),
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverGrid(
key: const Key('home-all-dramas-grid'),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 14,
crossAxisSpacing: 10,
childAspectRatio: 2 / 3,
),
delegate: SliverChildBuilderDelegate(
(context, index) => _HomeDramaCard(
l10n: l10n,
drama: dramas[index],
onTap: () => onOpen(dramas[index]),
),
childCount: dramas.length,
),
),
return SliverMainAxisGroup(
slivers: [
_dramaGrid(dramas),
const SliverToBoxAdapter(child: SizedBox(height: 24)),
],
);
}
Widget _dramaGrid(List<Drama> dramas) => SliverPadding(
key: const Key('home-all-dramas-section'),
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverGrid(
key: const Key('home-all-dramas-grid'),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 14,
crossAxisSpacing: 10,
childAspectRatio: 2 / 3,
),
delegate: SliverChildBuilderDelegate(
(context, index) => _HomeDramaCard(
l10n: l10n,
drama: dramas[index],
onTap: () => onOpen(dramas[index]),
),
childCount: dramas.length,
),
),
);
Widget _fill(Widget child) {
return SliverFillRemaining(hasScrollBody: false, child: child);
}
}
class _HomeDramaCard extends StatelessWidget {
@@ -122,11 +120,37 @@ class _HomeDramaCard extends StatelessWidget {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0x00000000), Color(0xE6000000)],
stops: [0.4, 1],
colors: [Color(0x00000000), Color(0xE6100C0A)],
stops: [0.42, 1],
),
),
),
if (drama.isHot)
Positioned(
top: 8,
left: 8,
child: DecoratedBox(
decoration: BoxDecoration(
color: AppColors.blue,
borderRadius: BorderRadius.circular(6),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 2,
),
child: Text(
l10n.hot,
style: const TextStyle(
color: AppColors.onPrimary,
fontSize: 10,
fontWeight: FontWeight.w800,
height: 1.1,
),
),
),
),
),
Positioned(
left: 10,
right: 10,
@@ -141,10 +165,10 @@ class _HomeDramaCard extends StatelessWidget {
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w700,
height: 1.2,
color: AppColors.cream,
fontSize: 13,
fontWeight: FontWeight.w800,
height: 1.15,
),
),
const SizedBox(height: 4),