feat(ui): 更新品牌启动页与选集交互
This commit is contained in:
1 parent
4778ce2c75
commit
c1cb7d1c11
87 files changed
+919
-552
No files matched your search
@@ -120,7 +120,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
data: AppTheme.dark(),
|
||||
child: widget.embedded
|
||||
? content
|
||||
: Scaffold(backgroundColor: const Color(0xFF0B0C10), body: content),
|
||||
: Scaffold(backgroundColor: AppColors.ink, body: content),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -159,7 +159,6 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
onAction: widget.onAction,
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 24)),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -176,9 +175,9 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.cream,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontWeight: FontWeight.w800,
|
||||
height: 1.1,
|
||||
),
|
||||
),
|
||||
@@ -262,7 +261,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
];
|
||||
return SizedBox(
|
||||
key: const Key('home-category-chips'),
|
||||
height: 32,
|
||||
height: 36,
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: choices.length,
|
||||
@@ -275,20 +274,18 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 180),
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? AppColors.bluePressed
|
||||
: const Color(0xFF1C1E24),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: selected ? AppColors.blue : AppColors.raised,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
),
|
||||
child: Text(
|
||||
choice.label,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
color: selected ? Colors.white : AppColors.muted,
|
||||
color: selected ? AppColors.onPrimary : AppColors.cream,
|
||||
fontSize: 13,
|
||||
fontWeight: selected ? FontWeight.w600 : FontWeight.w500,
|
||||
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
|
||||
height: 1.1,
|
||||
),
|
||||
),
|
||||
@@ -302,8 +299,8 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
Widget _bottomNav(AppLocalizations l10n) => Container(
|
||||
height: 63,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFF0D0D11),
|
||||
border: Border(top: BorderSide(color: Color(0xFF242329))),
|
||||
color: AppColors.bar,
|
||||
border: Border(top: BorderSide(color: AppColors.outlineVariantDark)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
@@ -363,12 +360,12 @@ class _DiscoverNavItem extends StatelessWidget {
|
||||
Icon(
|
||||
icon,
|
||||
size: 21,
|
||||
color: selected ? _accent : const Color(0xFFCAC4C7),
|
||||
color: selected ? AppColors.blueSoft : AppColors.muted,
|
||||
),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: selected ? _accent : const Color(0xFFCAC4C7),
|
||||
color: selected ? AppColors.blueSoft : AppColors.muted,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -379,8 +376,7 @@ class _DiscoverNavItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
const _accent = AppColors.blueSoft;
|
||||
const _coin = Color(0xFFF5C451);
|
||||
const _coin = AppColors.gold;
|
||||
|
||||
class _BrandMark extends StatelessWidget {
|
||||
const _BrandMark();
|
||||
@@ -418,8 +414,10 @@ class _HeaderPill extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: const Color(0xFF1C1E24),
|
||||
shape: const StadiumBorder(side: BorderSide(color: Color(0x66F5C451))),
|
||||
color: AppColors.raised,
|
||||
shape: StadiumBorder(
|
||||
side: BorderSide(color: AppColors.gold.withValues(alpha: 0.45)),
|
||||
),
|
||||
child: InkWell(
|
||||
customBorder: const StadiumBorder(),
|
||||
onTap: onTap,
|
||||
@@ -434,9 +432,9 @@ class _HeaderPill extends StatelessWidget {
|
||||
label,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
color: AppColors.cream,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: FontWeight.w700,
|
||||
height: 1.1,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user