feat(ui): 合并品牌启动页与选集交互

This commit is contained in:
Zhou Weidong committed 2026-10-19 09:28:27 +08:00
commit 9df36bc358
87 files changed
+919 -552

No files matched your search

+4 -1
View File
@@ -45,7 +45,10 @@ app.*.map.json
/android/app/release /android/app/release
# Local demo media and internal planning are absent from the public repo. # Local demo media and internal planning are absent from the public repo.
/assets/ # Launcher/splash source icons are required at build time, so keep them tracked.
/assets/*
!/assets/icon/
!/assets/icon/*.png
/server/ /server/
/docs/ /docs/
/AGENTS.md /AGENTS.md
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Author: fruit.com.cn -->
<!-- Android 12 already shows the icon in the system splash. This layer stays
the same color so the icon is not drawn a second time. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
</layer-list>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Author: fruit.com.cn -->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/> <background android:drawable="@color/ic_launcher_background"/>
<foreground> <foreground>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -15,6 +15,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item> <item name="android:windowBackground">@color/splash_background</item>
</style> </style>
</resources> </resources>
+2 -2
View File
@@ -2,6 +2,6 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<resources> <resources>
<color name="splash_background">#FF000000</color> <color name="splash_background">#FF100C0A</color>
<color name="ic_launcher_background">#D74A7D</color> <color name="ic_launcher_background">#C4322A</color>
</resources> </resources>
+1 -1
View File
@@ -15,6 +15,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item> <item name="android:windowBackground">@color/splash_background</item>
</style> </style>
</resources> </resources>
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

+1 -1
View File
@@ -10,7 +10,7 @@ final class RunnerFlutterViewController: FlutterViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = .black view.backgroundColor = UIColor(red: 16.0 / 255.0, green: 12.0 / 255.0, blue: 10.0 / 255.0, alpha: 1)
} }
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -15,12 +15,10 @@
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" red="0" green="0" blue="0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.06274509803921569" green="0.047058823529411764" blue="0.0392156862745098" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="top-launch"/> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="cx-launch"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="bot-launch"/> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="cy-launch"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="lead-launch"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="trailing" secondItem="Ze5-6b-2t3" secondAttribute="trailing" id="trail-launch"/>
</constraints> </constraints>
</view> </view>
</viewController> </viewController>
@@ -30,6 +28,6 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="LaunchImage" width="168" height="185"/> <image name="LaunchImage" width="84" height="84"/>
</resources> </resources>
</document> </document>
@@ -18,6 +18,9 @@ class CatalogController extends ChangeNotifier {
HomeFeed feed = const HomeFeed(); HomeFeed feed = const HomeFeed();
bool loading = false; bool loading = false;
/// 第一次首页请求结束后为 true。之后的重试不再回到开屏。
bool settled = false;
String? error; String? error;
List<Drama> get dramas => feed.dramas; List<Drama> get dramas => feed.dramas;
@@ -36,6 +39,7 @@ class CatalogController extends ChangeNotifier {
error = 'catalogError'; error = 'catalogError';
} finally { } finally {
loading = false; loading = false;
settled = true;
notifyListeners(); notifyListeners();
} }
} }
+40 -15
View File
@@ -1,24 +1,49 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
/// Shared colors. Blue is the primary action color. /// Evening palette for the Indonesia launch.
///
/// Chili is the action color. Gold marks coins, rewards, and playback
/// progress. Cocoa surfaces keep the app in night-market light instead of
/// a cold utility screen.
abstract final class AppColors { abstract final class AppColors {
/// Klein Blue primary used by actions and selected states. /// Chili fill for buttons, selected chips, and brand marks.
static const blue = Color(0xFF002FA7); static const blue = Color(0xFFC4322A);
/// Pressed/active shade for blue surfaces. /// Pressed chili.
static const bluePressed = Color(0xFF00227A); static const bluePressed = Color(0xFF8E221C);
/// High-contrast blue for text and icons on dark surfaces. /// Coral for text and icons sitting on dark surfaces.
static const blueSoft = Color(0xFF5B7BE0); static const blueSoft = Color(0xFFFF8A72);
/// Coins, rewards, and the playback progress line.
static const gold = Color(0xFFF6C453);
/// Text placed on [gold].
static const onGold = Color(0xFF2A1810);
/// Text and icons placed directly on [blue]. /// Text and icons placed directly on [blue].
static const onPrimary = Color(0xFFFFFFFF); static const onPrimary = Color(0xFFFFFFFF);
static const ink = Color(0xFF0B0C10);
static const bar = Color(0xFF101114); /// Page background.
static const card = Color(0xFF17191F); static const ink = Color(0xFF100C0A);
static const muted = Color(0xFFB7BDC9);
static const outlineDark = Color(0xFF3A3C45); /// Bottom bar.
static const outlineVariantDark = Color(0xFF242329); static const bar = Color(0xFF1A1412);
static const outlineLight = Color(0xFF8A8E99);
static const outlineVariantLight = Color(0xFFD6D9E2); /// Cards lifted off [ink].
static const card = Color(0xFF241C19);
/// Chips and nested rows.
static const raised = Color(0xFF322824);
/// Primary text on dark surfaces.
static const cream = Color(0xFFF8F1EA);
static const muted = Color(0xFFB7A59C);
static const outlineDark = Color(0xFF4A3C36);
static const outlineVariantDark = Color(0xFF2A221F);
static const outlineLight = Color(0xFF8C7A72);
static const outlineVariantLight = Color(0xFFE4D5CC);
} }
+4 -4
View File
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
import 'app_colors.dart'; import 'app_colors.dart';
/// App-wide light and dark themes built from the approved Klein Blue palette. /// Light paper and warm-cocoa themes for the Indonesia evening palette.
abstract final class AppTheme { abstract final class AppTheme {
static const _lightBackground = Color(0xFFF8F7FC); static const _lightBackground = Color(0xFFFFF6F1);
static const _darkBackground = Color(0xFF101019); static const _darkBackground = AppColors.ink;
/// Light theme for system light mode. /// Light theme for system light mode.
static ThemeData light() => _build( static ThemeData light() => _build(
@@ -40,7 +40,7 @@ abstract final class AppTheme {
secondaryContainer: AppColors.bluePressed, secondaryContainer: AppColors.bluePressed,
onSecondaryContainer: AppColors.onPrimary, onSecondaryContainer: AppColors.onPrimary,
surface: _darkBackground, surface: _darkBackground,
onSurface: Colors.white, onSurface: AppColors.cream,
outline: AppColors.outlineDark, outline: AppColors.outlineDark,
outlineVariant: AppColors.outlineVariantDark, outlineVariant: AppColors.outlineVariantDark,
surfaceTint: AppColors.blueSoft, surfaceTint: AppColors.blueSoft,
+109 -98
View File
@@ -4,19 +4,17 @@ import 'package:flutter/material.dart';
import '../theme/app_colors.dart'; import '../theme/app_colors.dart';
const double _regularArtSize = 84; const double _regularIconSize = 48;
const double _compactArtSize = 60; const double _compactIconSize = 32;
const double _regularInnerSize = 56;
const double _compactInnerSize = 40;
const double _regularIconSize = 27;
const double _compactIconSize = 21;
const double _maxContentWidth = 260; const double _maxContentWidth = 260;
const double _regularHorizontal = 24;
const double _regularVertical = 28;
const double _compactPad = 16;
const double _regularGap = 20;
const double _compactGap = 12;
const double _actionMinHeight = 44; const double _actionMinHeight = 44;
const double _outerArtOpacity = 0.055;
const double _outerBorderOpacity = 0.11;
const double _innerArtOpacity = 0.11;
/// 统一空列表占位:柔和图标、标题、可选说明与操作。 /// 统一空列表占位:一枚图标、标题、可选说明与操作。
class EmptyState extends StatelessWidget { class EmptyState extends StatelessWidget {
const EmptyState({ const EmptyState({
super.key, super.key,
@@ -24,6 +22,7 @@ class EmptyState extends StatelessWidget {
required this.title, required this.title,
this.subtitle, this.subtitle,
this.actionLabel, this.actionLabel,
this.actionKey,
this.onAction, this.onAction,
this.compact = false, this.compact = false,
}); });
@@ -32,17 +31,12 @@ class EmptyState extends StatelessWidget {
final String title; final String title;
final String? subtitle; final String? subtitle;
final String? actionLabel; final String? actionLabel;
final Key? actionKey;
final VoidCallback? onAction; final VoidCallback? onAction;
final bool compact; final bool compact;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final dark = Theme.of(context).brightness == Brightness.dark;
final iconColor = dark ? AppColors.blueSoft : AppColors.blue;
final artSize = compact ? _compactArtSize : _regularArtSize;
final innerSize = compact ? _compactInnerSize : _regularInnerSize;
final iconSize = compact ? _compactIconSize : _regularIconSize;
final hasAction = actionLabel != null && onAction != null; final hasAction = actionLabel != null && onAction != null;
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(
@@ -51,8 +45,8 @@ class EmptyState extends StatelessWidget {
child: Padding( child: Padding(
key: const Key('empty-state-padding'), key: const Key('empty-state-padding'),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: compact ? 16 : 24, horizontal: compact ? _compactPad : _regularHorizontal,
vertical: compact ? 16 : 28, vertical: compact ? _compactPad : _regularVertical,
), ),
child: Semantics( child: Semantics(
container: true, container: true,
@@ -61,88 +55,16 @@ class EmptyState extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ExcludeSemantics( ExcludeSemantics(
child: Container( child: _EmptyMark(icon: icon, compact: compact),
key: const Key('empty-state-art'),
width: artSize,
height: artSize,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.blue.withValues(alpha: _outerArtOpacity),
border: Border.all(
color: AppColors.blue.withValues(
alpha: _outerBorderOpacity,
),
),
),
child: Container(
key: const Key('empty-state-art-inner'),
width: innerSize,
height: innerSize,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.blue.withValues(
alpha: _innerArtOpacity,
),
),
child: Icon(
icon,
key: const Key('empty-state-icon'),
size: iconSize,
color: iconColor,
),
),
),
), ),
SizedBox(height: compact ? 10 : 14), SizedBox(height: compact ? _compactGap : _regularGap),
ExcludeSemantics( _EmptyCopy(
child: Text( title: title,
title, subtitle: subtitle,
key: const Key('empty-state-title'), actionLabel: hasAction ? actionLabel : null,
maxLines: 2, actionKey: actionKey,
overflow: TextOverflow.ellipsis, onAction: hasAction ? onAction : null,
textAlign: TextAlign.center,
style: TextStyle(
color: scheme.onSurface,
fontSize: 15,
fontWeight: FontWeight.w600,
height: 1.35,
),
),
), ),
if (subtitle != null) ...[
const SizedBox(height: 6),
ExcludeSemantics(
child: Text(
subtitle!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: const TextStyle(
color: AppColors.muted,
fontSize: 12.5,
height: 1.45,
),
),
),
],
if (hasAction) ...[
const SizedBox(height: 8),
TextButton(
key: const Key('empty-state-action'),
onPressed: onAction,
style: TextButton.styleFrom(
foregroundColor: scheme.primary,
minimumSize: const Size(44, _actionMinHeight),
padding: const EdgeInsets.symmetric(horizontal: 14),
),
child: Text(
actionLabel!,
style: const TextStyle(fontSize: 13),
),
),
],
], ],
), ),
), ),
@@ -151,3 +73,92 @@ class EmptyState extends StatelessWidget {
); );
} }
} }
/// 空状态只留一枚图标,不加水印底和描边。
class _EmptyMark extends StatelessWidget {
const _EmptyMark({required this.icon, required this.compact});
final IconData icon;
final bool compact;
@override
Widget build(BuildContext context) {
final dark = Theme.of(context).brightness == Brightness.dark;
return Icon(
icon,
key: const Key('empty-state-icon'),
size: compact ? _compactIconSize : _regularIconSize,
color: dark ? AppColors.gold : AppColors.blue,
);
}
}
class _EmptyCopy extends StatelessWidget {
const _EmptyCopy({
required this.title,
required this.subtitle,
required this.actionLabel,
required this.actionKey,
required this.onAction,
});
final String title;
final String? subtitle;
final String? actionLabel;
final Key? actionKey;
final VoidCallback? onAction;
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ExcludeSemantics(
child: Text(
title,
key: const Key('empty-state-title'),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
color: scheme.onSurface,
fontSize: 15,
fontWeight: FontWeight.w600,
height: 1.35,
),
),
),
if (subtitle != null) ...[
const SizedBox(height: 6),
ExcludeSemantics(
child: Text(
subtitle!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: const TextStyle(
color: AppColors.muted,
fontSize: 12.5,
height: 1.45,
),
),
),
],
if (actionLabel != null && onAction != null) ...[
const SizedBox(height: 8),
TextButton(
key: actionKey ?? const Key('empty-state-action'),
onPressed: onAction,
style: TextButton.styleFrom(
foregroundColor: scheme.primary,
minimumSize: const Size(44, _actionMinHeight),
padding: const EdgeInsets.symmetric(horizontal: 14),
),
child: Text(actionLabel!, style: const TextStyle(fontSize: 13)),
),
],
],
);
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ class LibraryDramaTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
color: const Color(0xFF1B1C21), color: AppColors.card,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: InkWell( child: InkWell(
+4 -2
View File
@@ -8,7 +8,9 @@ import 'core/config/server_endpoint.dart';
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); await Future.wait([
await ServerEndpoint.load(); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]),
ServerEndpoint.load(),
]);
runApp(const LumaDramaApp()); runApp(const LumaDramaApp());
} }
+20 -22
View File
@@ -120,7 +120,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
data: AppTheme.dark(), data: AppTheme.dark(),
child: widget.embedded child: widget.embedded
? content ? 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, onAction: widget.onAction,
), ),
), ),
const SliverToBoxAdapter(child: SizedBox(height: 24)),
], ],
); );
@@ -176,9 +175,9 @@ class _DiscoverPageState extends State<DiscoverPage> {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: AppColors.cream,
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w800,
height: 1.1, height: 1.1,
), ),
), ),
@@ -262,7 +261,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
]; ];
return SizedBox( return SizedBox(
key: const Key('home-category-chips'), key: const Key('home-category-chips'),
height: 32, height: 36,
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: choices.length, itemCount: choices.length,
@@ -275,20 +274,18 @@ class _DiscoverPageState extends State<DiscoverPage> {
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 180), duration: const Duration(milliseconds: 180),
alignment: Alignment.center, alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
color: selected color: selected ? AppColors.blue : AppColors.raised,
? AppColors.bluePressed borderRadius: BorderRadius.circular(18),
: const Color(0xFF1C1E24),
borderRadius: BorderRadius.circular(16),
), ),
child: Text( child: Text(
choice.label, choice.label,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: selected ? Colors.white : AppColors.muted, color: selected ? AppColors.onPrimary : AppColors.cream,
fontSize: 13, fontSize: 13,
fontWeight: selected ? FontWeight.w600 : FontWeight.w500, fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
height: 1.1, height: 1.1,
), ),
), ),
@@ -302,8 +299,8 @@ class _DiscoverPageState extends State<DiscoverPage> {
Widget _bottomNav(AppLocalizations l10n) => Container( Widget _bottomNav(AppLocalizations l10n) => Container(
height: 63, height: 63,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0xFF0D0D11), color: AppColors.bar,
border: Border(top: BorderSide(color: Color(0xFF242329))), border: Border(top: BorderSide(color: AppColors.outlineVariantDark)),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -363,12 +360,12 @@ class _DiscoverNavItem extends StatelessWidget {
Icon( Icon(
icon, icon,
size: 21, size: 21,
color: selected ? _accent : const Color(0xFFCAC4C7), color: selected ? AppColors.blueSoft : AppColors.muted,
), ),
Text( Text(
label, label,
style: TextStyle( style: TextStyle(
color: selected ? _accent : const Color(0xFFCAC4C7), color: selected ? AppColors.blueSoft : AppColors.muted,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@@ -379,8 +376,7 @@ class _DiscoverNavItem extends StatelessWidget {
); );
} }
const _accent = AppColors.blueSoft; const _coin = AppColors.gold;
const _coin = Color(0xFFF5C451);
class _BrandMark extends StatelessWidget { class _BrandMark extends StatelessWidget {
const _BrandMark(); const _BrandMark();
@@ -418,8 +414,10 @@ class _HeaderPill extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
color: const Color(0xFF1C1E24), color: AppColors.raised,
shape: const StadiumBorder(side: BorderSide(color: Color(0x66F5C451))), shape: StadiumBorder(
side: BorderSide(color: AppColors.gold.withValues(alpha: 0.45)),
),
child: InkWell( child: InkWell(
customBorder: const StadiumBorder(), customBorder: const StadiumBorder(),
onTap: onTap, onTap: onTap,
@@ -434,9 +432,9 @@ class _HeaderPill extends StatelessWidget {
label, label,
maxLines: 1, maxLines: 1,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: AppColors.cream,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w700,
height: 1.1, height: 1.1,
), ),
), ),
+82 -58
View File
@@ -16,28 +16,20 @@ class _HomeDramaGrid extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (categories.loading && categories.feed.sections.isEmpty) { if (categories.loading && categories.feed.sections.isEmpty) {
return const SliverPadding( return const SliverFillRemaining(
padding: EdgeInsets.symmetric(vertical: 24), hasScrollBody: false,
sliver: SliverToBoxAdapter( child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
),
); );
} }
if (categories.error != null) { if (categories.error != null) {
return SliverPadding( return _fill(
padding: const EdgeInsets.fromLTRB(16, 6, 16, 18), EmptyState(
sliver: SliverToBoxAdapter( key: const Key('home-categories-error'),
child: Row( icon: Icons.cloud_off_rounded,
children: [ title: l10n.categoriesError,
Expanded( subtitle: l10n.emptyHint,
child: Text( actionLabel: l10n.retry,
l10n.categoriesError, onAction: categories.load,
style: const TextStyle(color: AppColors.muted),
),
),
TextButton(onPressed: categories.load, child: Text(l10n.retry)),
],
),
), ),
); );
} }
@@ -45,45 +37,51 @@ class _HomeDramaGrid extends StatelessWidget {
final dramas = categories.visibleDramas; final dramas = categories.visibleDramas;
if (dramas.isEmpty) { if (dramas.isEmpty) {
final missingCategory = categories.selectedSectionMissing; final missingCategory = categories.selectedSectionMissing;
return SliverPadding( return _fill(
padding: const EdgeInsets.fromLTRB(16, 6, 16, 24), EmptyState(
sliver: SliverToBoxAdapter( key: const Key('home-all-dramas-empty'),
child: EmptyState( icon: missingCategory
key: const Key('home-all-dramas-empty'), ? Icons.grid_view_rounded
icon: missingCategory : Icons.search_off_rounded,
? Icons.grid_view_rounded title: missingCategory ? l10n.noCategoryDramas : l10n.noSearchResults,
: Icons.search_off_rounded, subtitle: l10n.emptyHint,
title: missingCategory
? l10n.noCategoryDramas
: l10n.noSearchResults,
subtitle: l10n.emptyHint,
),
), ),
); );
} }
return SliverPadding( return SliverMainAxisGroup(
key: const Key('home-all-dramas-section'), slivers: [
padding: const EdgeInsets.symmetric(horizontal: 16), _dramaGrid(dramas),
sliver: SliverGrid( const SliverToBoxAdapter(child: SizedBox(height: 24)),
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 _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 { class _HomeDramaCard extends StatelessWidget {
@@ -122,11 +120,37 @@ class _HomeDramaCard extends StatelessWidget {
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [Color(0x00000000), Color(0xE6000000)], colors: [Color(0x00000000), Color(0xE6100C0A)],
stops: [0.4, 1], 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( Positioned(
left: 10, left: 10,
right: 10, right: 10,
@@ -141,10 +165,10 @@ class _HomeDramaCard extends StatelessWidget {
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: AppColors.cream,
fontSize: 14, fontSize: 13,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w800,
height: 1.2, height: 1.15,
), ),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
+10 -34
View File
@@ -54,9 +54,9 @@ class _DownloadsPageState extends State<DownloadsPage> {
data: AppTheme.dark(), data: AppTheme.dark(),
child: Scaffold( child: Scaffold(
key: const Key('downloads-page'), key: const Key('downloads-page'),
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
appBar: AppBar( appBar: AppBar(
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
foregroundColor: Colors.white, foregroundColor: Colors.white,
title: Text(l10n.downloads), title: Text(l10n.downloads),
), ),
@@ -79,41 +79,17 @@ class _DownloadsBody extends StatelessWidget {
if (downloads.loading && downloads.policy == null) { if (downloads.loading && downloads.policy == null) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
if (downloads.error != null && downloads.policy == null) { if (downloads.policy == null) {
return Center( return EmptyState(
key: const Key('downloads-error'), key: const Key('downloads-error'),
child: Padding( icon: Icons.cloud_off_rounded,
padding: const EdgeInsets.symmetric(horizontal: 32), title: errorText(l10n, downloads.error, l10n.downloadsError),
child: Column( actionLabel: l10n.retry,
mainAxisSize: MainAxisSize.min, actionKey: const Key('downloads-retry'),
children: [ onAction: () => unawaited(downloads.load()),
Text(
errorText(l10n, downloads.error, l10n.downloadsError),
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70),
),
const SizedBox(height: 14),
FilledButton(
key: const Key('downloads-retry'),
onPressed: () => unawaited(downloads.load()),
child: Text(l10n.retry),
),
],
),
),
);
}
final policy = downloads.policy;
if (policy == null) {
return Center(
key: const Key('downloads-error'),
child: FilledButton(
key: const Key('downloads-retry'),
onPressed: () => unawaited(downloads.load()),
child: Text(l10n.retry),
),
); );
} }
final policy = downloads.policy!;
return RefreshIndicator( return RefreshIndicator(
onRefresh: downloads.load, onRefresh: downloads.load,
child: ListView( child: ListView(
@@ -79,13 +79,13 @@ class _DramaDetailPageState extends State<DramaDetailPage> {
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
if (logic.loading) { if (logic.loading) {
return const Scaffold( return const Scaffold(
backgroundColor: Color(0xFF111111), backgroundColor: AppColors.ink,
body: Center(child: CircularProgressIndicator()), body: Center(child: CircularProgressIndicator()),
); );
} }
if (logic.failed) { if (logic.failed) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFF111111), backgroundColor: AppColors.ink,
body: Center( body: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32), padding: const EdgeInsets.symmetric(horizontal: 32),
@@ -109,9 +109,9 @@ class _DramaDetailPageState extends State<DramaDetailPage> {
if (drama.episodes.isEmpty) { if (drama.episodes.isEmpty) {
// 空态:详情拿到了但一集都没有(还没上传/审核中),不能白屏 // 空态:详情拿到了但一集都没有(还没上传/审核中),不能白屏
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFF111111), backgroundColor: AppColors.ink,
appBar: AppBar( appBar: AppBar(
backgroundColor: const Color(0xFF111111), backgroundColor: AppColors.ink,
foregroundColor: Colors.white, foregroundColor: Colors.white,
title: Text(localizedDramaTitle(l10n, drama)), title: Text(localizedDramaTitle(l10n, drama)),
), ),
@@ -126,12 +126,13 @@ class _DramaDetailPageState extends State<DramaDetailPage> {
); );
} }
return Scaffold( return Scaffold(
backgroundColor: AppColors.ink,
body: CustomScrollView( body: CustomScrollView(
slivers: [ slivers: [
SliverAppBar( SliverAppBar(
expandedHeight: 300, expandedHeight: 300,
pinned: true, pinned: true,
backgroundColor: const Color(0xFF111111), backgroundColor: AppColors.ink,
foregroundColor: Colors.white, foregroundColor: Colors.white,
actions: [ actions: [
_reportAction(context, l10n), _reportAction(context, l10n),
+9 -22
View File
@@ -10,6 +10,7 @@ import '../../core/data/services/auth_controller.dart';
import '../../core/data/services/favorite_controller.dart'; import '../../core/data/services/favorite_controller.dart';
import '../../core/formatting/error_text.dart'; import '../../core/formatting/error_text.dart';
import '../../core/platform/haptics.dart'; import '../../core/platform/haptics.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_theme.dart'; import '../../core/theme/app_theme.dart';
import '../../core/widgets/auth_gate.dart'; import '../../core/widgets/auth_gate.dart';
import '../../core/widgets/empty_state.dart'; import '../../core/widgets/empty_state.dart';
@@ -52,9 +53,9 @@ class _FavoritesPageState extends State<FavoritesPage> {
return Theme( return Theme(
data: AppTheme.dark(), data: AppTheme.dark(),
child: Scaffold( child: Scaffold(
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
appBar: AppBar( appBar: AppBar(
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
foregroundColor: Colors.white, foregroundColor: Colors.white,
title: Text(l10n.myFavorites), title: Text(l10n.myFavorites),
), ),
@@ -78,27 +79,13 @@ class _FavoritesBody extends StatelessWidget {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
if (favorites.error != null && favorites.cards.isEmpty) { if (favorites.error != null && favorites.cards.isEmpty) {
return Center( return EmptyState(
key: const Key('favorites-error'), key: const Key('favorites-error'),
child: Padding( icon: Icons.cloud_off_rounded,
padding: const EdgeInsets.symmetric(horizontal: 32), title: errorText(l10n, favorites.error, l10n.favoritesError),
child: Column( actionLabel: l10n.retry,
mainAxisSize: MainAxisSize.min, actionKey: const Key('favorites-retry'),
children: [ onAction: () => unawaited(favorites.load()),
Text(
errorText(l10n, favorites.error, l10n.favoritesError),
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70),
),
const SizedBox(height: 14),
FilledButton(
key: const Key('favorites-retry'),
onPressed: () => unawaited(favorites.load()),
child: Text(l10n.retry),
),
],
),
),
); );
} }
if (favorites.cards.isEmpty) { if (favorites.cards.isEmpty) {
+34 -28
View File
@@ -18,6 +18,7 @@ import '../../core/widgets/empty_state.dart';
import '../../core/widgets/server_endpoint_dialog.dart'; import '../../core/widgets/server_endpoint_dialog.dart';
import '../../l10n/app_localizations.dart'; import '../../l10n/app_localizations.dart';
import '../discover/discover_view.dart'; import '../discover/discover_view.dart';
import '../splash/splash_page.dart';
import '../mine/mine_view.dart'; import '../mine/mine_view.dart';
import '../player/player_view.dart'; import '../player/player_view.dart';
import 'home_binding.dart'; import 'home_binding.dart';
@@ -30,6 +31,7 @@ class HomePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final catalog = context.watch<CatalogController>(); final catalog = context.watch<CatalogController>();
if (!catalog.settled) return const SplashPage();
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
return Theme( return Theme(
data: AppTheme.dark(), data: AppTheme.dark(),
@@ -44,13 +46,13 @@ class HomePage extends StatelessWidget {
) { ) {
if (catalog.loading) { if (catalog.loading) {
return const Scaffold( return const Scaffold(
backgroundColor: Colors.black, backgroundColor: AppColors.ink,
body: Center(child: CircularProgressIndicator()), body: Center(child: CircularProgressIndicator()),
); );
} }
if (catalog.error != null) { if (catalog.error != null) {
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: AppColors.ink,
body: HomeFailureView( body: HomeFailureView(
onRetry: catalog.load, onRetry: catalog.load,
showDebugTools: kDebugMode, showDebugTools: kDebugMode,
@@ -59,7 +61,7 @@ class HomePage extends StatelessWidget {
} }
if (catalog.dramas.isEmpty) { if (catalog.dramas.isEmpty) {
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: AppColors.ink,
body: EmptyState( body: EmptyState(
key: const Key('home-empty'), key: const Key('home-empty'),
icon: Icons.movie_outlined, icon: Icons.movie_outlined,
@@ -92,33 +94,37 @@ class HomeFailureView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
return Center( return Column(
children: [
Expanded(
child: EmptyState(
icon: Icons.cloud_off_rounded,
title: l10n.catalogError,
actionLabel: l10n.retry,
onAction: onRetry,
),
),
if (showDebugTools) _debugTools(context, l10n),
],
);
}
Widget _debugTools(BuildContext context, AppLocalizations l10n) {
return Padding(
padding: const EdgeInsets.fromLTRB(24, 0, 24, 24),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon( Text(
Icons.error_outline_rounded, AppConfig.apiBaseUrl,
color: Colors.white70, style: const TextStyle(fontSize: 12, color: AppColors.muted),
size: 40, ),
const SizedBox(height: 8),
OutlinedButton.icon(
key: const Key('home-server-settings'),
onPressed: () => showServerEndpointDialog(context, l10n),
icon: const Icon(Icons.dns_outlined),
label: Text(l10n.serverSettings),
), ),
const SizedBox(height: 12),
Text(l10n.catalogError),
const SizedBox(height: 12),
FilledButton(onPressed: onRetry, child: Text(l10n.retry)),
if (showDebugTools) ...[
const SizedBox(height: 16),
Text(
AppConfig.apiBaseUrl,
style: const TextStyle(fontSize: 12, color: Colors.white54),
),
const SizedBox(height: 8),
OutlinedButton.icon(
key: const Key('home-server-settings'),
onPressed: () => showServerEndpointDialog(context, l10n),
icon: const Icon(Icons.dns_outlined),
label: Text(l10n.serverSettings),
),
],
], ],
), ),
); );
@@ -340,7 +346,7 @@ class _TabButton extends StatelessWidget {
vertical: 3, vertical: 3,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: selected ? AppColors.bluePressed : null, color: selected ? AppColors.blue : null,
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
), ),
child: Icon( child: Icon(
@@ -29,8 +29,8 @@ class HomeQuickDrawer extends StatelessWidget {
final VoidCallback onWatchlist; final VoidCallback onWatchlist;
final VoidCallback onLiked; final VoidCallback onLiked;
static const _panel = Color(0xFF222225); static const _panel = AppColors.card;
static const _card = Color(0xFF303033); static const _card = AppColors.raised;
static const _accent = AppColors.blueSoft; static const _accent = AppColors.blueSoft;
@override @override
@@ -129,8 +129,8 @@ class HomeQuickDrawer extends StatelessWidget {
key: const Key('drawer-open-series'), key: const Key('drawer-open-series'),
onPressed: onOpenSeries, onPressed: onOpenSeries,
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
backgroundColor: _accent, backgroundColor: AppColors.blue,
foregroundColor: Colors.white, foregroundColor: AppColors.onPrimary,
), ),
icon: const Icon(Icons.play_arrow_rounded), icon: const Icon(Icons.play_arrow_rounded),
label: Text(l10n.exploreSeries), label: Text(l10n.exploreSeries),
+2 -1
View File
@@ -9,6 +9,7 @@ import '../../core/config/locale_controller.dart';
import '../../core/data/models/drama.dart'; import '../../core/data/models/drama.dart';
import '../../core/data/models/watch_progress.dart'; import '../../core/data/models/watch_progress.dart';
import '../../core/data/repositories/watch_history_repository.dart'; import '../../core/data/repositories/watch_history_repository.dart';
import '../../core/theme/app_colors.dart';
import '../../core/widgets/server_endpoint_dialog.dart'; import '../../core/widgets/server_endpoint_dialog.dart';
import '../../l10n/app_localizations.dart'; import '../../l10n/app_localizations.dart';
@@ -120,7 +121,7 @@ class MineLogic extends ChangeNotifier {
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
await showModalBottomSheet<void>( await showModalBottomSheet<void>(
context: context, context: context,
backgroundColor: const Color(0xFF1C1D22), backgroundColor: AppColors.ink,
showDragHandle: true, showDragHandle: true,
isScrollControlled: true, isScrollControlled: true,
builder: (sheetContext) => SafeArea( builder: (sheetContext) => SafeArea(
+33 -42
View File
@@ -158,7 +158,7 @@ class _MyPageState extends State<MyPage> {
data: AppTheme.dark(), data: AppTheme.dark(),
child: widget.embedded child: widget.embedded
? content ? content
: Scaffold(backgroundColor: const Color(0xFF0B0C10), body: content), : Scaffold(backgroundColor: AppColors.ink, body: content),
); );
} }
@@ -188,7 +188,7 @@ class _MyPageState extends State<MyPage> {
const SizedBox(width: 6), const SizedBox(width: 6),
const CircleAvatar( const CircleAvatar(
radius: 14, radius: 14,
backgroundColor: Color(0xFF2C2D33), backgroundColor: AppColors.raised,
child: Icon(Icons.person_rounded, color: Colors.white, size: 19), child: Icon(Icons.person_rounded, color: Colors.white, size: 19),
), ),
], ],
@@ -229,7 +229,7 @@ class _MyPageState extends State<MyPage> {
children: [ children: [
const CircleAvatar( const CircleAvatar(
radius: 28, radius: 28,
backgroundColor: Color(0xFF32343A), backgroundColor: AppColors.raised,
child: Icon(Icons.person_rounded, color: Colors.white, size: 30), child: Icon(Icons.person_rounded, color: Colors.white, size: 30),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
@@ -269,7 +269,7 @@ class _MyPageState extends State<MyPage> {
children: [ children: [
const CircleAvatar( const CircleAvatar(
radius: 28, radius: 28,
backgroundColor: Color(0xFF32343A), backgroundColor: AppColors.raised,
child: Icon(Icons.person_rounded, color: Colors.white, size: 30), child: Icon(Icons.person_rounded, color: Colors.white, size: 30),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
@@ -297,7 +297,7 @@ class _MyPageState extends State<MyPage> {
TextButton( TextButton(
onPressed: widget.onSignOut ?? () => _mockSnack(l10n), onPressed: widget.onSignOut ?? () => _mockSnack(l10n),
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: const Color(0xFF2A2C33), backgroundColor: AppColors.raised,
foregroundColor: Colors.white, foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
shape: const StadiumBorder(), shape: const StadiumBorder(),
@@ -312,7 +312,7 @@ class _MyPageState extends State<MyPage> {
return Container( return Container(
padding: const EdgeInsets.all(14), padding: const EdgeInsets.all(14),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF17191F), color: AppColors.card,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
@@ -330,7 +330,7 @@ class _MyPageState extends State<MyPage> {
label: l10n.coins, label: l10n.coins,
value: '\$ 0', value: '\$ 0',
action: l10n.topUpWallet, action: l10n.topUpWallet,
color: AppColors.blue, color: AppColors.gold,
onPressed: () => _mockSnack(l10n), onPressed: () => _mockSnack(l10n),
), ),
), ),
@@ -340,7 +340,7 @@ class _MyPageState extends State<MyPage> {
label: l10n.vipMembership, label: l10n.vipMembership,
value: l10n.notActive, value: l10n.notActive,
action: l10n.joinVip, action: l10n.joinVip,
color: const Color(0xFFF5C451), color: AppColors.blue,
onPressed: () => _mockSnack(l10n), onPressed: () => _mockSnack(l10n),
), ),
), ),
@@ -367,7 +367,7 @@ class _MyPageState extends State<MyPage> {
return Container( return Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF12141A), color: AppColors.ink,
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
border: Border.all(color: color.withValues(alpha: 0.45)), border: Border.all(color: color.withValues(alpha: 0.45)),
), ),
@@ -389,7 +389,7 @@ class _MyPageState extends State<MyPage> {
backgroundColor: color, backgroundColor: color,
foregroundColor: color == AppColors.blue foregroundColor: color == AppColors.blue
? Colors.white ? Colors.white
: const Color(0xFF2A2110), : AppColors.onGold,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
shape: const StadiumBorder(), shape: const StadiumBorder(),
), ),
@@ -403,7 +403,7 @@ class _MyPageState extends State<MyPage> {
Widget _menuCard(AppLocalizations l10n) { Widget _menuCard(AppLocalizations l10n) {
return Material( return Material(
color: const Color(0xFF17191F), color: AppColors.card,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Column( child: Column(
@@ -420,7 +420,7 @@ class _MyPageState extends State<MyPage> {
), ),
onTap: () => _mockSnack(l10n), onTap: () => _mockSnack(l10n),
), ),
const Divider(height: 1, color: Color(0xFF2A2C33)), const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile( ListTile(
key: const Key('mine-notices'), key: const Key('mine-notices'),
leading: const Icon( leading: const Icon(
@@ -433,7 +433,7 @@ class _MyPageState extends State<MyPage> {
MaterialPageRoute(builder: (_) => const NoticesPage()), MaterialPageRoute(builder: (_) => const NoticesPage()),
), ),
), ),
const Divider(height: 1, color: Color(0xFF2A2C33)), const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile( ListTile(
leading: const Icon( leading: const Icon(
Icons.history_rounded, Icons.history_rounded,
@@ -445,7 +445,7 @@ class _MyPageState extends State<MyPage> {
MaterialPageRoute(builder: (_) => const WatchRecordsPage()), MaterialPageRoute(builder: (_) => const WatchRecordsPage()),
), ),
), ),
const Divider(height: 1, color: Color(0xFF2A2C33)), const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile( ListTile(
leading: const Icon( leading: const Icon(
Icons.favorite_outline_rounded, Icons.favorite_outline_rounded,
@@ -457,7 +457,7 @@ class _MyPageState extends State<MyPage> {
MaterialPageRoute(builder: (_) => const FavoritesPage()), MaterialPageRoute(builder: (_) => const FavoritesPage()),
), ),
), ),
const Divider(height: 1, color: Color(0xFF2A2C33)), const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile( ListTile(
leading: const Icon( leading: const Icon(
Icons.download_outlined, Icons.download_outlined,
@@ -469,7 +469,7 @@ class _MyPageState extends State<MyPage> {
MaterialPageRoute(builder: (_) => const DownloadsPage()), MaterialPageRoute(builder: (_) => const DownloadsPage()),
), ),
), ),
const Divider(height: 1, color: Color(0xFF2A2C33)), const Divider(height: 1, color: AppColors.outlineVariantDark),
ListTile( ListTile(
leading: const Icon( leading: const Icon(
Icons.settings_rounded, Icons.settings_rounded,
@@ -530,8 +530,8 @@ class _MyPageState extends State<MyPage> {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: logic.section == index color: logic.section == index
? AppColors.bluePressed ? AppColors.blue
: const Color(0xFF24262E), : AppColors.raised,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Text( child: Text(
@@ -564,8 +564,8 @@ class _MyPageState extends State<MyPage> {
onSelected: (_) => logic.selectFilter(index), onSelected: (_) => logic.selectFilter(index),
showCheckmark: false, showCheckmark: false,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
backgroundColor: const Color(0xFF242328), backgroundColor: AppColors.raised,
selectedColor: _accent, selectedColor: AppColors.blue,
labelStyle: TextStyle( labelStyle: TextStyle(
color: logic.filter == index color: logic.filter == index
? Colors.white ? Colors.white
@@ -592,7 +592,7 @@ class _MyPageState extends State<MyPage> {
child: Container( child: Container(
padding: const EdgeInsets.all(9), padding: const EdgeInsets.all(9),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF1B1C21), color: AppColors.card,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: Row( child: Row(
@@ -635,7 +635,7 @@ class _MyPageState extends State<MyPage> {
), ),
const CircleAvatar( const CircleAvatar(
radius: 15, radius: 15,
backgroundColor: Color(0xFF313137), backgroundColor: AppColors.raised,
child: Icon( child: Icon(
Icons.play_arrow_rounded, Icons.play_arrow_rounded,
color: _accent, color: _accent,
@@ -658,21 +658,12 @@ class _MyPageState extends State<MyPage> {
), ),
) )
else if (isWatchlist && favorites.error != null) else if (isWatchlist && favorites.error != null)
Padding( EmptyState(
padding: const EdgeInsets.symmetric(vertical: 18), icon: Icons.cloud_off_rounded,
child: Column( title: errorText(l10n, favorites.error, l10n.favoritesError),
crossAxisAlignment: CrossAxisAlignment.start, actionLabel: l10n.retry,
children: [ onAction: () => unawaited(favorites.load()),
Text( compact: true,
errorText(l10n, favorites.error, l10n.favoritesError),
style: const TextStyle(color: Color(0xFFE6E1E3)),
),
TextButton(
onPressed: () => unawaited(favorites.load()),
child: Text(l10n.retry),
),
],
),
) )
else if (logic.section != 0 && markedDramas.isNotEmpty) else if (logic.section != 0 && markedDramas.isNotEmpty)
for (final drama in markedDramas) ...[ for (final drama in markedDramas) ...[
@@ -789,7 +780,7 @@ class _MyPageState extends State<MyPage> {
child: Container( child: Container(
padding: const EdgeInsets.all(9), padding: const EdgeInsets.all(9),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF1B1C21), color: AppColors.card,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: Row( child: Row(
@@ -832,8 +823,8 @@ class _MyPageState extends State<MyPage> {
Widget _bottomNav(AppLocalizations l10n) => Container( Widget _bottomNav(AppLocalizations l10n) => Container(
height: 63, height: 63,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0xFF0D0D11), color: AppColors.bar,
border: Border(top: BorderSide(color: Color(0xFF242329))), border: Border(top: BorderSide(color: AppColors.outlineVariantDark)),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -898,12 +889,12 @@ class _NavItem extends StatelessWidget {
Icon( Icon(
icon, icon,
size: 21, size: 21,
color: selected ? _accent : const Color(0xFFCAC4C7), color: selected ? _accent : AppColors.muted,
), ),
Text( Text(
label, label,
style: TextStyle( style: TextStyle(
color: selected ? _accent : const Color(0xFFCAC4C7), color: selected ? _accent : AppColors.muted,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
+9 -20
View File
@@ -74,28 +74,17 @@ class _NoticesPageState extends State<NoticesPage> {
children: [ children: [
SizedBox( SizedBox(
height: MediaQuery.sizeOf(context).height * 0.7, height: MediaQuery.sizeOf(context).height * 0.7,
child: Center( child: EmptyState(
key: const Key('notices-error'), key: const Key('notices-error'),
child: Column( icon: Icons.cloud_off_rounded,
mainAxisSize: MainAxisSize.min, title: errorText(
children: [ l10n,
Text( _controller.error,
errorText( l10n.noticesLoadFailed,
l10n,
_controller.error,
l10n.noticesLoadFailed,
),
textAlign: TextAlign.center,
style: const TextStyle(color: AppColors.muted),
),
const SizedBox(height: 12),
FilledButton(
key: const Key('notices-retry'),
onPressed: _controller.load,
child: Text(l10n.retry),
),
],
), ),
actionLabel: l10n.retry,
actionKey: const Key('notices-retry'),
onAction: _controller.load,
), ),
), ),
], ],
+26 -34
View File
@@ -29,6 +29,9 @@ import '../mine/mine_logic.dart';
import '../mine/mine_view.dart'; import '../mine/mine_view.dart';
import 'player_view.dart'; import 'player_view.dart';
import 'widgets/drama_comments_sheet.dart'; import 'widgets/drama_comments_sheet.dart';
import 'widgets/episode_picker_cell.dart';
const double _episodeCellAspect = 1.05;
class PlayerLogic extends ChangeNotifier { class PlayerLogic extends ChangeNotifier {
PlayerLogic({ PlayerLogic({
@@ -616,7 +619,7 @@ class PlayerLogic extends ChangeNotifier {
try { try {
await showModalBottomSheet<void>( await showModalBottomSheet<void>(
context: context, context: context,
backgroundColor: const Color(0xFF16171C), backgroundColor: AppColors.ink,
showDragHandle: true, showDragHandle: true,
builder: (sheetContext) => SafeArea( builder: (sheetContext) => SafeArea(
child: SizedBox( child: SizedBox(
@@ -655,7 +658,7 @@ class PlayerLogic extends ChangeNotifier {
crossAxisCount: 6, crossAxisCount: 6,
mainAxisSpacing: 10, mainAxisSpacing: 10,
crossAxisSpacing: 10, crossAxisSpacing: 10,
childAspectRatio: 1.45, childAspectRatio: _episodeCellAspect,
), ),
itemCount: episodes.length, itemCount: episodes.length,
itemBuilder: (_, index) => _episodeCell( itemBuilder: (_, index) => _episodeCell(
@@ -706,38 +709,27 @@ class PlayerLogic extends ChangeNotifier {
int currentNumber, int currentNumber,
) { ) {
final selected = episode.number == currentNumber; final selected = episode.number == currentNumber;
return Material( final l10n = AppLocalizations.of(pageContext)!;
color: selected ? AppColors.bluePressed : const Color(0xFF2A2C33), return EpisodePickerCell(
borderRadius: BorderRadius.circular(8), episode: episode,
child: InkWell( selected: selected,
borderRadius: BorderRadius.circular(8), lockLabel: l10n.locked,
onTap: () { onTap: () {
Navigator.of(sheetContext).pop(); Navigator.of(sheetContext).pop();
if (homeFeed) { if (homeFeed) {
if (episode.number == currentNumber) return; if (episode.number == currentNumber) return;
unawaited(openSeriesAt(pageContext, drama, index)); unawaited(openSeriesAt(pageContext, drama, index));
return; return;
} }
if (index == session.currentIndex) return; if (index == session.currentIndex) return;
unawaited( unawaited(
pages.animateToPage( pages.animateToPage(
index, index,
duration: const Duration(milliseconds: 260), duration: const Duration(milliseconds: 260),
curve: Curves.easeOutCubic, curve: Curves.easeOutCubic,
),
);
},
child: Center(
child: Text(
'${episode.number}',
style: const TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w600,
),
), ),
), );
), },
); );
} }
@@ -843,7 +835,7 @@ class PlayerLogic extends ChangeNotifier {
await showModalBottomSheet<void>( await showModalBottomSheet<void>(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
backgroundColor: const Color(0xFF232328), backgroundColor: AppColors.ink,
showDragHandle: true, showDragHandle: true,
builder: (_) => DramaCommentsSheet(drama: drama), builder: (_) => DramaCommentsSheet(drama: drama),
); );
+105 -47
View File
@@ -136,7 +136,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
data: AppTheme.dark(), data: AppTheme.dark(),
child: widget.embedded child: widget.embedded
? content ? content
: Scaffold(backgroundColor: Colors.black, body: content), : Scaffold(backgroundColor: AppColors.ink, body: content),
), ),
); );
} }
@@ -183,7 +183,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
return Stack( return Stack(
fit: StackFit.expand, fit: StackFit.expand,
children: [ children: [
const ColoredBox(color: Colors.black), const ColoredBox(color: AppColors.ink),
?video, ?video,
if (!logic.chromeHidden) if (!logic.chromeHidden)
const IgnorePointer( const IgnorePointer(
@@ -304,7 +304,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
child: IgnorePointer( child: IgnorePointer(
child: DecoratedBox( child: DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0x73000000), color: AppColors.blue,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: Padding( child: Padding(
@@ -494,31 +494,91 @@ class _BlockedNotice extends StatelessWidget {
: l10n.noMediaNotice; : l10n.noMediaNotice;
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 36), padding: const EdgeInsets.symmetric(horizontal: 28),
child: _UnlockCard(
locked: needsUnlock,
title: title,
coinLabel: needsUnlock && unlockCoin > 0
? '$unlockCoin ${l10n.coins}'
: null,
footnote: needsUnlock ? l10n.unlockComingSoon : null,
),
),
);
}
}
/// Coin lock presented as a reward card: gold chip, chili only on the icon.
class _UnlockCard extends StatelessWidget {
const _UnlockCard({
required this.locked,
required this.title,
required this.coinLabel,
required this.footnote,
});
final bool locked;
final String title;
final String? coinLabel;
final String? footnote;
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(
color: AppColors.card,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: AppColors.gold.withValues(alpha: 0.55)),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 22, 20, 18),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Icon(
needsUnlock locked ? Icons.lock_outline_rounded : Icons.movie_filter_outlined,
? Icons.lock_outline_rounded color: locked ? AppColors.gold : AppColors.cream,
: Icons.movie_filter_outlined, size: 32,
color: Colors.white70,
size: 36,
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Text( Text(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70), style: const TextStyle(
color: AppColors.cream,
fontSize: 16,
fontWeight: FontWeight.w700,
),
), ),
if (needsUnlock) ...[ if (coinLabel != null) ...[
const SizedBox(height: 6), const SizedBox(height: 12),
DecoratedBox(
decoration: BoxDecoration(
color: AppColors.gold,
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
child: Text(
coinLabel!,
style: const TextStyle(
color: AppColors.onGold,
fontSize: 13,
fontWeight: FontWeight.w800,
),
),
),
),
],
if (footnote != null) ...[
const SizedBox(height: 8),
Text( Text(
unlockCoin > 0 footnote!,
? '${l10n.unlockComingSoon} · $unlockCoin ${l10n.coins}'
: l10n.unlockComingSoon,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white38, fontSize: 12), style: const TextStyle(color: AppColors.muted, fontSize: 12),
), ),
], ],
], ],
@@ -674,14 +734,14 @@ class _PlaybackOverlay extends StatelessWidget {
children: [ children: [
_RailAction( _RailAction(
key: const Key('rail-like'), key: const Key('rail-like'),
icon: liked ? Icons.favorite_rounded : Icons.favorite_border_rounded, icon: Icons.favorite_border,
label: l10n.like, label: l10n.like,
selected: liked, selected: liked,
onTap: onLike, onTap: onLike,
), ),
_RailAction( _RailAction(
key: const Key('rail-save'), key: const Key('rail-save'),
icon: saved ? Icons.bookmark_rounded : Icons.bookmark_border_rounded, icon: Icons.bookmark_border,
label: l10n.save, label: l10n.save,
selected: saved, selected: saved,
onTap: onSave, onTap: onSave,
@@ -693,19 +753,19 @@ class _PlaybackOverlay extends StatelessWidget {
onTap: onDownload, onTap: onDownload,
), ),
_RailAction( _RailAction(
icon: Icons.grid_view_rounded, icon: Icons.grid_view_outlined,
label: l10n.episodes, label: l10n.episodes,
onTap: onEpisodes, onTap: onEpisodes,
), ),
_RailAction( _RailAction(
key: const Key('rail-comments'), key: const Key('rail-comments'),
icon: Icons.mode_comment_outlined, icon: Icons.chat_bubble_outline,
label: l10n.comments, label: l10n.comments,
onTap: onComments, onTap: onComments,
), ),
_RailAction( _RailAction(
key: const Key('rail-share'), key: const Key('rail-share'),
icon: Icons.share_rounded, icon: Icons.share_outlined,
label: l10n.share, label: l10n.share,
onTap: onShare, onTap: onShare,
), ),
@@ -713,10 +773,16 @@ class _PlaybackOverlay extends StatelessWidget {
IconButton( IconButton(
tooltip: l10n.pictureInPicture, tooltip: l10n.pictureInPicture,
onPressed: onPip, onPressed: onPip,
visualDensity: VisualDensity.compact, padding: EdgeInsets.zero,
iconSize: 20, constraints: const BoxConstraints.tightFor(
color: Colors.white, width: _railTapSize,
icon: const Icon(Icons.picture_in_picture_alt_outlined), height: _railTapSize,
),
color: AppColors.cream,
icon: const Icon(
Icons.picture_in_picture_alt_outlined,
size: _railIconSize,
),
), ),
], ],
); );
@@ -748,6 +814,10 @@ class _PlaybackOverlay extends StatelessWidget {
); );
} }
const double _railIconSize = 28;
const double _railIconWeight = 300;
const double _railTapSize = 44;
class _RailAction extends StatelessWidget { class _RailAction extends StatelessWidget {
const _RailAction({ const _RailAction({
super.key, super.key,
@@ -762,28 +832,16 @@ class _RailAction extends StatelessWidget {
final bool selected; final bool selected;
@override @override
Widget build(BuildContext context) => Column( Widget build(BuildContext context) => IconButton(
mainAxisSize: MainAxisSize.min, tooltip: label,
children: [ onPressed: onTap,
IconButton( padding: EdgeInsets.zero,
tooltip: label, constraints: const BoxConstraints.tightFor(
onPressed: onTap, width: _railTapSize,
visualDensity: VisualDensity.compact, height: _railTapSize,
padding: EdgeInsets.zero, ),
constraints: const BoxConstraints.tightFor(width: 42, height: 36), color: selected ? AppColors.blueSoft : AppColors.cream,
color: selected ? AppColors.blueSoft : Colors.white, icon: Icon(icon, size: _railIconSize, weight: _railIconWeight, fill: 0),
icon: Icon(icon, size: 24),
),
Text(
label,
style: const TextStyle(
color: Colors.white,
fontSize: 11,
fontWeight: FontWeight.w600,
shadows: [Shadow(blurRadius: 8, color: Colors.black)],
),
),
],
); );
} }
+3 -3
View File
@@ -52,11 +52,11 @@ class CommentTile extends StatelessWidget {
children: [ children: [
CircleAvatar( CircleAvatar(
radius: isReply ? 12 : 16, radius: isReply ? 12 : 16,
backgroundColor: AppColors.blue.withValues(alpha: 0.2), backgroundColor: AppColors.raised,
child: Icon( child: Icon(
Icons.person_rounded, Icons.person_rounded,
size: isReply ? 14 : 18, size: isReply ? 14 : 18,
color: AppColors.blueSoft, color: AppColors.cream,
), ),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
@@ -101,7 +101,7 @@ class CommentTile extends StatelessWidget {
), ),
Text( Text(
comment.content, comment.content,
style: const TextStyle(color: Colors.white, fontSize: 14), style: const TextStyle(color: AppColors.cream, fontSize: 14),
), ),
if (comment.isPending) if (comment.isPending)
Padding( Padding(
@@ -19,9 +19,10 @@ import '../../../l10n/app_localizations.dart';
import '../../interaction/widgets/report_dialog.dart'; import '../../interaction/widgets/report_dialog.dart';
import 'comment_tile.dart'; import 'comment_tile.dart';
const double _minSheetHeight = 240; const double _minSheetHeight = 280;
const double _maxSheetHeight = 460; const double _maxSheetHeight = 520;
const int _maxCommentLength = 300; const int _maxCommentLength = 300;
const double _composerRadius = 22;
/// 服务端评论底部弹窗:匿名列表、游标翻页、回复、点赞和本人删除。 /// 服务端评论底部弹窗:匿名列表、游标翻页、回复、点赞和本人删除。
class DramaCommentsSheet extends StatefulWidget { class DramaCommentsSheet extends StatefulWidget {
@@ -164,7 +165,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
child: SafeArea( child: SafeArea(
top: false, top: false,
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8), padding: const EdgeInsets.fromLTRB(20, 4, 20, 12),
child: ListenableBuilder( child: ListenableBuilder(
listenable: _controller, listenable: _controller,
builder: (context, _) => _content(context), builder: (context, _) => _content(context),
@@ -182,9 +183,13 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
children: [ children: [
Text( Text(
l10n.comments, l10n.comments,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w700), style: const TextStyle(
color: AppColors.cream,
fontSize: 18,
fontWeight: FontWeight.w700,
),
), ),
const SizedBox(height: 8), const SizedBox(height: 12),
Expanded(child: _list(l10n)), Expanded(child: _list(l10n)),
if (_replyTo != null) _replyBanner(l10n, _replyTo!), if (_replyTo != null) _replyBanner(l10n, _replyTo!),
_composer(l10n), _composer(l10n),
@@ -199,24 +204,14 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
); );
} }
if (_controller.error != null && _controller.comments.isEmpty) { if (_controller.error != null && _controller.comments.isEmpty) {
return Center( return EmptyState(
key: const Key('comment-list-error'), key: const Key('comment-list-error'),
child: Column( icon: Icons.cloud_off_rounded,
mainAxisSize: MainAxisSize.min, title: errorText(l10n, _controller.error, l10n.commentsLoadFailed),
children: [ actionLabel: l10n.retry,
Text( actionKey: const Key('comment-list-retry'),
errorText(l10n, _controller.error, l10n.commentsLoadFailed), onAction: _controller.load,
textAlign: TextAlign.center, compact: true,
style: const TextStyle(color: AppColors.muted),
),
const SizedBox(height: 8),
TextButton(
key: const Key('comment-list-retry'),
onPressed: _controller.load,
child: Text(l10n.retry),
),
],
),
); );
} }
if (_controller.comments.isEmpty) { if (_controller.comments.isEmpty) {
@@ -272,7 +267,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
l10n.replyingTo( l10n.replyingTo(
replyTo.nickname.isEmpty ? l10n.anonymousUser : replyTo.nickname, replyTo.nickname.isEmpty ? l10n.anonymousUser : replyTo.nickname,
), ),
style: const TextStyle(color: AppColors.blueSoft, fontSize: 12), style: const TextStyle(color: AppColors.muted, fontSize: 12),
), ),
), ),
IconButton( IconButton(
@@ -286,6 +281,25 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
), ),
); );
InputDecoration _composerDecoration(String hint) {
const radius = BorderRadius.all(Radius.circular(_composerRadius));
const clear = OutlineInputBorder(
borderRadius: radius,
borderSide: BorderSide.none,
);
return InputDecoration(
hintText: hint,
hintStyle: const TextStyle(color: AppColors.muted, fontSize: 14),
counterText: '',
filled: true,
fillColor: AppColors.raised,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
border: clear,
enabledBorder: clear,
focusedBorder: clear,
);
}
Widget _composer(AppLocalizations l10n) => Row( Widget _composer(AppLocalizations l10n) => Row(
children: [ children: [
Expanded( Expanded(
@@ -295,16 +309,9 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
focusNode: _inputFocus, focusNode: _inputFocus,
maxLength: _maxCommentLength, maxLength: _maxCommentLength,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( style: const TextStyle(color: AppColors.cream, fontSize: 14),
hintText: l10n.writeComment, cursorColor: AppColors.gold,
counterText: '', decoration: _composerDecoration(l10n.writeComment),
filled: true,
fillColor: const Color(0xFF35353A),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(14),
borderSide: BorderSide.none,
),
),
onSubmitted: (_) => _post(), onSubmitted: (_) => _post(),
), ),
), ),
@@ -387,7 +394,7 @@ class _CommentThread extends StatelessWidget {
], ],
), ),
), ),
const Divider(height: 1), const Divider(height: 1, color: AppColors.outlineVariantDark),
], ],
); );
} }
@@ -0,0 +1,116 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
import '../../../core/data/models/drama.dart';
import '../../../core/theme/app_colors.dart';
const double _cellRadius = 8;
const double _numberSize = 15;
const double _lockSize = 16;
const double _lockGap = 4;
const double _lockWeight = 300;
const double _coverAlpha = 0.45;
/// 选集格子。需要解锁时铺一层透明底,锁在上,集数在锁下面。
class EpisodePickerCell extends StatelessWidget {
const EpisodePickerCell({
required this.episode,
required this.selected,
required this.lockLabel,
required this.onTap,
super.key,
});
final Episode episode;
final bool selected;
final String lockLabel;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Material(
clipBehavior: Clip.antiAlias,
color: selected ? AppColors.bluePressed : AppColors.raised,
borderRadius: BorderRadius.circular(_cellRadius),
child: InkWell(
onTap: onTap,
child: Stack(
fit: StackFit.expand,
children: [
if (!episode.locked) Center(child: _EpisodeNumber(episode.number)),
if (episode.locked)
_LockCover(
episodeId: episode.id,
number: episode.number,
label: lockLabel,
),
],
),
),
);
}
}
class _EpisodeNumber extends StatelessWidget {
const _EpisodeNumber(this.number);
final int number;
@override
Widget build(BuildContext context) {
return Text(
'$number',
style: const TextStyle(
color: AppColors.cream,
fontSize: _numberSize,
fontWeight: FontWeight.w600,
height: 1,
),
);
}
}
/// 透明底铺满格子,锁在上,集数在锁下面。
class _LockCover extends StatelessWidget {
const _LockCover({
required this.episodeId,
required this.number,
required this.label,
});
final String episodeId;
final int number;
final String label;
@override
Widget build(BuildContext context) {
return Stack(
fit: StackFit.expand,
children: [
ColoredBox(
key: ValueKey('episode-lock-cover-$episodeId'),
color: AppColors.ink.withValues(alpha: _coverAlpha),
),
Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.lock_outline,
key: ValueKey('episode-lock-$episodeId'),
size: _lockSize,
weight: _lockWeight,
fill: 0,
color: AppColors.gold,
semanticLabel: label,
),
const SizedBox(height: _lockGap),
_EpisodeNumber(number),
],
),
),
],
);
}
}
@@ -120,7 +120,7 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
child: SliderTheme( child: SliderTheme(
data: SliderTheme.of(context).copyWith( data: SliderTheme.of(context).copyWith(
trackHeight: scrubbing ? 4 : 3, trackHeight: scrubbing ? 4 : 3,
activeTrackColor: AppColors.blueSoft, activeTrackColor: AppColors.gold,
inactiveTrackColor: Colors.white30, inactiveTrackColor: Colors.white30,
thumbColor: Colors.white, thumbColor: Colors.white,
thumbShape: RoundSliderThumbShape( thumbShape: RoundSliderThumbShape(
+53
View File
@@ -0,0 +1,53 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
import '../../core/theme/app_colors.dart';
const double _markSize = 84;
const double _markRadius = 18;
const double _loaderSize = 22;
const double _loaderStroke = 2.5;
const String _markAsset = 'assets/icon/splash_mark.png';
/// 系统开屏已经放好同一块底和图标。这一页接上加载,直到首页数据回来。
class SplashPage extends StatelessWidget {
const SplashPage({super.key});
@override
Widget build(BuildContext context) {
return ColoredBox(
key: Key('splash-screen'),
color: AppColors.ink,
child: Stack(
fit: StackFit.expand,
children: [
Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(_markRadius),
child: const Image(
image: AssetImage(_markAsset),
width: _markSize,
height: _markSize,
filterQuality: FilterQuality.medium,
gaplessPlayback: true,
),
),
),
Align(
alignment: Alignment(0, 0.24),
child: SizedBox(
width: _loaderSize,
height: _loaderSize,
child: CircularProgressIndicator(
key: Key('splash-loading'),
strokeWidth: _loaderStroke,
color: AppColors.gold,
),
),
),
],
),
);
}
}
@@ -35,9 +35,9 @@ class WatchRecordsPage extends StatelessWidget {
data: AppTheme.dark(), data: AppTheme.dark(),
child: Scaffold( child: Scaffold(
key: const Key('watch-records-page'), key: const Key('watch-records-page'),
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
appBar: AppBar( appBar: AppBar(
backgroundColor: const Color(0xFF0B0C10), backgroundColor: AppColors.ink,
foregroundColor: Colors.white, foregroundColor: Colors.white,
title: Text(l10n.watchHistory), title: Text(l10n.watchHistory),
), ),
@@ -359,26 +359,12 @@ class _FailureState extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
return Center( return EmptyState(
child: Padding( icon: Icons.cloud_off_rounded,
padding: const EdgeInsets.symmetric(horizontal: 32), title: message,
child: Column( actionLabel: l10n.retry,
mainAxisSize: MainAxisSize.min, actionKey: const Key('watch-records-retry'),
children: [ onAction: () => unawaited(onRetry()),
Text(
message,
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white70),
),
const SizedBox(height: 14),
FilledButton(
key: const Key('watch-records-retry'),
onPressed: () => unawaited(onRetry()),
child: Text(l10n.retry),
),
],
),
),
); );
} }
} }
+3 -1
View File
@@ -79,6 +79,8 @@ flutter:
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.
uses-material-design: true uses-material-design: true
assets:
- assets/icon/splash_mark.png
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
@@ -115,6 +117,6 @@ flutter_launcher_icons:
android: true android: true
ios: true ios: true
image_path: assets/icon/fruitshorts.png image_path: assets/icon/fruitshorts.png
adaptive_icon_background: "#D74A7D" adaptive_icon_background: "#C4322A"
adaptive_icon_foreground: assets/icon/fruitshorts.png adaptive_icon_foreground: assets/icon/fruitshorts.png
remove_alpha_ios: true remove_alpha_ios: true
@@ -11,7 +11,9 @@ void main() {
final repository = ScriptedCatalogRepository(); final repository = ScriptedCatalogRepository();
final controller = CatalogController(repository); final controller = CatalogController(repository);
expect(controller.settled, isFalse);
await controller.load(); await controller.load();
expect(controller.settled, isTrue);
expect(controller.dramas, isEmpty); expect(controller.dramas, isEmpty);
expect(controller.error, isNull); expect(controller.error, isNull);
+2 -1
View File
@@ -12,6 +12,7 @@ import 'package:fruitshorts/core/data/repositories/interaction_repository.dart';
import 'package:fruitshorts/core/data/services/auth_controller.dart'; import 'package:fruitshorts/core/data/services/auth_controller.dart';
import 'package:fruitshorts/core/data/services/auth_session_store.dart'; import 'package:fruitshorts/core/data/services/auth_session_store.dart';
import 'package:fruitshorts/core/platform/haptics.dart'; import 'package:fruitshorts/core/platform/haptics.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/core/widgets/empty_state.dart'; import 'package:fruitshorts/core/widgets/empty_state.dart';
import 'package:fruitshorts/l10n/app_localizations.dart'; import 'package:fruitshorts/l10n/app_localizations.dart';
import 'package:fruitshorts/pages/player/widgets/drama_comments_sheet.dart'; import 'package:fruitshorts/pages/player/widgets/drama_comments_sheet.dart';
@@ -352,7 +353,7 @@ Future<void> _pumpSheet(
localizationsDelegates: AppLocalizations.localizationsDelegates, localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales, supportedLocales: AppLocalizations.supportedLocales,
home: const Scaffold( home: const Scaffold(
backgroundColor: Color(0xFF232328), backgroundColor: AppColors.ink,
body: DramaCommentsSheet(drama: _drama), body: DramaCommentsSheet(drama: _drama),
), ),
), ),
@@ -148,6 +148,15 @@ void main() {
expect(find.byKey(const Key('home-all-dramas-title')), findsNothing); expect(find.byKey(const Key('home-all-dramas-title')), findsNothing);
expect(find.text('No matching dramas.'), findsOneWidget); expect(find.text('No matching dramas.'), findsOneWidget);
final content = tester.getCenter(
find.byKey(const Key('empty-state-content')),
);
final chipsBottom = tester
.getBottomLeft(find.byKey(const Key('home-category-chips')))
.dy;
final feed = tester.getRect(find.byType(CustomScrollView));
expect(content.dx, closeTo(feed.center.dx, 1));
expect(content.dy, closeTo((chipsBottom + feed.bottom) / 2, 36));
await tester.tap(find.text('Romance')); await tester.tap(find.text('Romance'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@@ -168,6 +177,10 @@ void main() {
expect(find.byKey(const Key('home-all-dramas-title')), findsNothing); expect(find.byKey(const Key('home-all-dramas-title')), findsNothing);
expect(find.text('Categories could not be loaded.'), findsOneWidget); expect(find.text('Categories could not be loaded.'), findsOneWidget);
expect(find.text('Retry'), findsOneWidget); expect(find.text('Retry'), findsOneWidget);
expect(find.byKey(const Key('empty-state-icon')), findsOneWidget);
final icon = tester.getCenter(find.byKey(const Key('empty-state-icon')));
final feed = tester.getRect(find.byType(CustomScrollView));
expect(icon.dx, closeTo(feed.center.dx, 1));
expect(find.byKey(const Key('home-all-dramas-grid')), findsNothing); expect(find.byKey(const Key('home-all-dramas-grid')), findsNothing);
}); });
+10 -32
View File
@@ -22,34 +22,19 @@ void main() {
), ),
); );
expect(find.byKey(const Key('empty-state-art')), findsOneWidget); expect(find.byKey(const Key('empty-state-art')), findsNothing);
expect(find.byKey(const Key('empty-state-art-inner')), findsOneWidget); expect(find.byKey(const Key('empty-state-art-inner')), findsNothing);
expect(find.byKey(const Key('empty-state-icon')), findsOneWidget); expect(find.byKey(const Key('empty-state-icon')), findsOneWidget);
expect(find.text('No stories'), findsOneWidget); expect(find.text('No stories'), findsOneWidget);
expect(find.text('New content will appear here.'), findsOneWidget); expect(find.text('New content will appear here.'), findsOneWidget);
expect(
tester.getSize(find.byKey(const Key('empty-state-art'))),
const Size(84, 84),
);
expect(
tester.getSize(find.byKey(const Key('empty-state-art-inner'))),
const Size(56, 56),
);
expect( expect(
tester.getSize(find.byKey(const Key('empty-state-icon'))), tester.getSize(find.byKey(const Key('empty-state-icon'))),
const Size(27, 27), const Size(48, 48),
); );
final outer = tester.widget<Container>( expect(
find.byKey(const Key('empty-state-art')), tester.widget<Icon>(find.byKey(const Key('empty-state-icon'))).color,
AppColors.gold,
); );
final outerDecoration = outer.decoration! as BoxDecoration;
expect(outerDecoration.shape, BoxShape.circle);
expect(outerDecoration.color?.a, closeTo(0.055, 0.001));
expect(outerDecoration.border!.top.color.a, closeTo(0.11, 0.001));
final inner = tester.widget<Container>(
find.byKey(const Key('empty-state-art-inner')),
);
expect((inner.decoration! as BoxDecoration).color?.a, closeTo(0.11, 0.001));
expect( expect(
tester tester
.widget<Padding>(find.byKey(const Key('empty-state-padding'))) .widget<Padding>(find.byKey(const Key('empty-state-padding')))
@@ -97,18 +82,11 @@ void main() {
), ),
); );
expect(
tester.getSize(find.byKey(const Key('empty-state-art'))),
const Size(60, 60),
);
expect(
tester.getSize(find.byKey(const Key('empty-state-art-inner'))),
const Size(40, 40),
);
expect( expect(
tester.getSize(find.byKey(const Key('empty-state-icon'))), tester.getSize(find.byKey(const Key('empty-state-icon'))),
const Size(21, 21), const Size(32, 32),
); );
expect(find.byType(DecoratedBox), findsNothing);
expect( expect(
tester tester
.widget<Text>(find.byKey(const Key('empty-state-title'))) .widget<Text>(find.byKey(const Key('empty-state-title')))
@@ -125,7 +103,7 @@ void main() {
expect(find.byKey(const Key('empty-state-action')), findsNothing); expect(find.byKey(const Key('empty-state-action')), findsNothing);
}); });
testWidgets('should_use_theme_aware_icon_colors', (tester) async { testWidgets('should_tint_the_bare_icon_for_light_and_dark', (tester) async {
await _pump( await _pump(
tester, tester,
theme: AppTheme.dark(), theme: AppTheme.dark(),
@@ -133,7 +111,7 @@ void main() {
); );
expect( expect(
tester.widget<Icon>(find.byKey(const Key('empty-state-icon'))).color, tester.widget<Icon>(find.byKey(const Key('empty-state-icon'))).color,
AppColors.blueSoft, AppColors.gold,
); );
await _pump( await _pump(
+73
View File
@@ -0,0 +1,73 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/data/models/drama.dart';
import 'package:fruitshorts/pages/player/widgets/episode_picker_cell.dart';
void main() {
testWidgets('should_show_lock_when_episode_needs_unlock', (tester) async {
await tester.pumpWidget(
_host(
const Episode(
id: '12',
number: 12,
title: 'Paid',
isFree: false,
locked: true,
),
),
);
expect(find.byIcon(Icons.lock_outline), findsOneWidget);
expect(find.text('12'), findsOneWidget);
final cell = tester.getRect(find.byType(EpisodePickerCell));
final cover = tester.getRect(find.byKey(const ValueKey('episode-lock-cover-12')));
final number = tester.getRect(find.text('12'));
final lock = tester.getRect(find.byIcon(Icons.lock_outline));
expect(number.overlaps(lock), isFalse);
expect(number.top, greaterThanOrEqualTo(lock.bottom));
final wash = tester.widget<ColoredBox>(
find.byKey(const ValueKey('episode-lock-cover-12')),
);
expect(cover.width, greaterThanOrEqualTo(cell.width - 1));
expect(cover.height, greaterThanOrEqualTo(cell.height - 1));
expect(cover.contains(lock.center), isTrue);
expect(wash.color.a, greaterThan(0));
expect(wash.color.a, lessThan(1));
});
testWidgets('should_hide_lock_when_episode_is_free', (tester) async {
await tester.pumpWidget(
_host(
const Episode(
id: '1',
number: 1,
title: 'Free',
isFree: true,
),
),
);
expect(find.byIcon(Icons.lock_outline), findsNothing);
expect(find.byKey(const ValueKey('episode-lock-cover-1')), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
Widget _host(Episode episode) {
return MaterialApp(
home: Scaffold(
body: SizedBox(
width: 52,
height: 50,
child: EpisodePickerCell(
episode: episode,
selected: false,
lockLabel: 'Locked',
onTap: () {},
),
),
),
);
}
+59
View File
@@ -0,0 +1,59 @@
// Author: fruit.com.cn
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/data/models/drama.dart';
import 'package:fruitshorts/core/data/models/home_feed.dart';
import 'package:fruitshorts/core/data/repositories/catalog_repository.dart';
import 'package:fruitshorts/core/data/services/catalog_controller.dart';
import 'package:fruitshorts/l10n/app_localizations.dart';
import 'package:fruitshorts/pages/home/home_view.dart';
import 'package:provider/provider.dart';
void main() {
testWidgets(
'should_keep_splash_with_loading_until_home_feed_settles',
(tester) async {
final repository = _PendingCatalog();
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: ChangeNotifierProvider(
create: (_) => CatalogController(repository)..load(),
child: const HomePage(),
),
),
);
expect(find.byKey(const Key('splash-screen')), findsOneWidget);
expect(find.byKey(const Key('splash-loading')), findsOneWidget);
expect(find.byKey(const Key('home-empty')), findsNothing);
final clip = tester.widget<ClipRRect>(find.byType(ClipRRect));
expect(clip.borderRadius, BorderRadius.circular(18));
repository.pending.complete(const HomeFeed());
await tester.pump();
await tester.pump();
expect(find.byKey(const Key('splash-screen')), findsNothing);
expect(find.byKey(const Key('home-empty')), findsOneWidget);
},
);
}
class _PendingCatalog implements CatalogRepository {
final Completer<HomeFeed> pending = Completer<HomeFeed>();
@override
Future<HomeFeed> fetchHomeFeed() => pending.future;
@override
Future<HomeFeed> fetchDiscoverFeed() => pending.future;
@override
Future<Drama> fetchDrama(String dramaId) =>
Future<Drama>.error(StateError('unused'));
}
+11 -6
View File
@@ -14,11 +14,16 @@ double _contrast(Color foreground, Color background) {
} }
void main() { void main() {
test('should_expose_approved_klein_blue_tokens', () { test('should_expose_indonesia_evening_brand_tokens', () {
expect(AppColors.blue, const Color(0xFF002FA7)); expect(AppColors.blue, const Color(0xFFC4322A));
expect(AppColors.bluePressed, const Color(0xFF00227A)); expect(AppColors.bluePressed, const Color(0xFF8E221C));
expect(AppColors.blueSoft, const Color(0xFF5B7BE0)); expect(AppColors.blueSoft, const Color(0xFFFF8A72));
expect(AppColors.gold, const Color(0xFFF6C453));
expect(AppColors.onPrimary, const Color(0xFFFFFFFF)); expect(AppColors.onPrimary, const Color(0xFFFFFFFF));
expect(
_contrast(AppColors.onGold, AppColors.gold),
greaterThanOrEqualTo(4.5),
);
}); });
test('should_meet_text_and_icon_contrast_when_using_theme_tokens', () { test('should_meet_text_and_icon_contrast_when_using_theme_tokens', () {
@@ -33,7 +38,7 @@ void main() {
); );
}); });
test('should_use_klein_blue_in_light_and_dark_color_schemes', () { test('should_use_chili_brand_in_light_and_dark_color_schemes', () {
for (final theme in [AppTheme.light(), AppTheme.dark()]) { for (final theme in [AppTheme.light(), AppTheme.dark()]) {
expect(theme.colorScheme.primary, AppColors.blue); expect(theme.colorScheme.primary, AppColors.blue);
expect(theme.colorScheme.onPrimary, AppColors.onPrimary); expect(theme.colorScheme.onPrimary, AppColors.onPrimary);
@@ -52,7 +57,7 @@ void main() {
expect(light.outlineVariant.computeLuminance(), lessThan(0.92)); expect(light.outlineVariant.computeLuminance(), lessThan(0.92));
}); });
testWidgets('should_expose_klein_blue_through_widget_theme', (tester) async { testWidgets('should_expose_chili_brand_through_widget_theme', (tester) async {
late ThemeData applied; late ThemeData applied;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
+1 -1
View File
@@ -278,7 +278,7 @@ void main() {
}, },
); );
testWidgets('should_fit_compact_dark_viewport_when_klein_theme_is_used', ( testWidgets('should_fit_compact_dark_viewport_when_evening_theme_is_used', (
tester, tester,
) async { ) async {
tester.view.physicalSize = const Size(320, 568); tester.view.physicalSize = const Size(320, 568);