20 Commits
Author SHA1 Message Date
Vicky fe0e77775e merge: 合并奖励中心与我的页视觉优化
flutter-ci / test (push) Failing after 22m27s
2026-11-13 17:42:22 +08:00
Zhou Weidong 6ef5429a52 style(mine): 重构紧凑 VIP 会员入口 2026-11-13 17:41:47 +08:00
Zhou Weidong 9ef78ad670 style(reward): 优化奖励中心金币图标 2026-11-13 17:41:31 +08:00
Zhou Weidong bea08110c9 feat(reward): 新增客户端奖励中心 2026-11-13 13:43:38 +08:00
Vicky 67670d46b1 feat(auth): 接入 Google 登录
- 登录页保留邮箱与 Google 两个入口,Google 按钮按官方规范改为白底四色图标
- 新增 GoogleAuthService:封装 initialize/authenticate,失败以结果对象返回
- AuthApi 增加 googleLogin,AuthController 增加 signInWithGoogle
- iOS 补充 CFBundleURLTypes 与 GIDClientID,Bundle ID 统一为 com.stormg.lumadrama
- Google 请求期间按钮显示转圈并禁止重复点击
2026-11-13 12:30:47 +08:00
Zhou Weidong 7b90bd59b9 style(home): 观看全集按钮轮廓进一步压淡
flutter-ci / test (push) Failing after 19m31s
2026-11-04 15:18:42 +08:00
Zhou Weidong 938435dfb9 style(home): 观看全集按钮改为半透明白玻璃表面
flutter-ci / test (push) Failing after 19m26s
2026-11-04 15:01:36 +08:00
Zhou Weidong b61bfe625c style(home): 观看全集按钮改用深酒红表面
flutter-ci / test (push) Failing after 19m29s
2026-11-04 14:51:20 +08:00
Zhou Weidong a7b4277536 style(home): 观看全集按钮改用暖深炭灰
flutter-ci / test (push) Failing after 19m24s
2026-11-04 14:24:21 +08:00
Zhou Weidong dabff48f7c merge: 首页观看全集配色匹配设计稿
flutter-ci / test (push) Failing after 20m24s
2026-11-04 13:44:42 +08:00
Zhou Weidong 6acc00394b style(home): 匹配观看全集设计稿配色 2026-11-04 13:42:47 +08:00
Zhou Weidong f3cfd0d0ec merge: 客户端播放器交互优化
flutter-ci / test (push) Failing after 19m31s
2026-11-03 18:28:31 +08:00
Zhou Weidong 35cbdd2bd3 perf(player): 优化点击响应与互动反馈 2026-11-03 18:28:14 +08:00
Zhou Weidong 3ad371aa9d style(download): 补全条件分支花括号
flutter-ci / test (push) Failing after 21m34s
2026-11-02 14:44:38 +08:00
Zhou Weidong 7463d3ee26 refactor(empty-state): 空状态支持内容居中 2026-11-02 14:44:38 +08:00
Zhou Weidong 59fbd33059 feat(category): 分类频道接入榜单快照 2026-11-02 14:44:38 +08:00
Zhou Weidong 8c1662475a feat(ranking): 榜单改为统一行布局 2026-11-02 14:44:32 +08:00
Zhou Weidong 7f65fe4d48 feat(media): 图片占位改为纯色块并去掉扫光 2026-11-02 14:44:28 +08:00
Zhou Weidong 613147c20c feat(branding): 更换应用图标与开屏资源 2026-11-02 14:44:23 +08:00
Zhou Weidong 731638b31b merge: 同步 v1.0.1 发布版本到 develop
flutter-ci / test (push) Canceled after 0s
2026-10-31 14:40:37 +08:00
180 changed files with 5949 additions and 1478 deletions

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -2,18 +2,6 @@
<!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="350dp"
android:startColor="#FF6B011A"
android:centerColor="#616B011A"
android:endColor="#006B011A" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
@@ -2,18 +2,6 @@
<!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="350dp"
android:startColor="#FF6B011A"
android:centerColor="#616B011A"
android:endColor="#006B011A" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
@@ -2,18 +2,6 @@
<!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="350dp"
android:startColor="#FF6B011A"
android:centerColor="#616B011A"
android:endColor="#006B011A" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
@@ -2,18 +2,6 @@
<!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="350dp"
android:startColor="#FF6B011A"
android:centerColor="#616B011A"
android:endColor="#006B011A" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 12 KiB

@@ -2,18 +2,6 @@
<!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" />
<item>
<shape android:shape="rectangle">
<gradient
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="350dp"
android:startColor="#FF6B011A"
android:centerColor="#616B011A"
android:endColor="#006B011A" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 623 B

+2 -2
View File
@@ -3,5 +3,5 @@
<resources>
<color name="splash_background">#000000</color>
<color name="ic_launcher_background">#E9142E</color>
</resources>
<color name="ic_launcher_background">#000000</color>
</resources>
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+3 -3
View File
@@ -387,7 +387,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadramv;
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadrama;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -567,7 +567,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadramv;
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadrama;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -590,7 +590,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadramv;
PRODUCT_BUNDLE_IDENTIFIER = com.stormg.lumadrama;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -0,0 +1,68 @@
{
"pins" : [
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "b7c71458b70284cc0f5a87103f66f0b1d98b1873",
"version" : "12.1.0"
}
},
{
"identity" : "appauth-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/openid/AppAuth-iOS.git",
"state" : {
"revision" : "a972daac82d449d58ab119e91c68153e29ddac33",
"version" : "3.0.0"
}
},
{
"identity" : "googlesignin-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleSignIn-iOS.git",
"state" : {
"revision" : "bfaebbc04a4d13ed7a89b0fc1fb8ad66b362cc1c",
"version" : "10.1.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "5459ee5603def3db0fe14ca522185f42c48d978e",
"version" : "8.1.5"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "724a52eea6329b7e12d3ad8300d76ca9f3895fcc",
"version" : "5.3.1"
}
},
{
"identity" : "gtmappauth",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GTMAppAuth.git",
"state" : {
"revision" : "57094cd46bc8700d3a887e2a429f42b6e8ea3f0b",
"version" : "6.0.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
"version" : "101.0.0"
}
}
],
"version" : 2
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 KiB

After

Width:  |  Height:  |  Size: 20 KiB

+13
View File
@@ -24,6 +24,19 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.11115008580-51gv4sj2c78rud6n127g3shu4d2n96un</string>
</array>
</dict>
</array>
<key>GIDClientID</key>
<string>11115008580-51gv4sj2c78rud6n127g3shu4d2n96un.apps.googleusercontent.com</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
+18 -1
View File
@@ -21,6 +21,7 @@ import 'core/data/remote/interaction_api.dart';
import 'core/data/remote/library_api.dart';
import 'core/data/remote/notice_api.dart';
import 'core/data/remote/playback_api.dart';
import 'core/data/remote/reward_api.dart';
import 'core/data/remote/watch_api.dart';
import 'core/data/repositories/catalog_repository.dart';
import 'core/data/repositories/account_repository.dart';
@@ -33,6 +34,7 @@ import 'core/data/repositories/interaction_repository.dart';
import 'core/data/repositories/notice_repository.dart';
import 'core/data/repositories/playback_repository.dart';
import 'core/data/repositories/playlist_repository.dart';
import 'core/data/repositories/reward_repository.dart';
import 'core/data/repositories/search_repository.dart';
import 'core/data/repositories/store_repository.dart';
import 'core/data/repositories/watch_history_repository.dart';
@@ -49,6 +51,7 @@ import 'core/data/services/playlist_controller.dart';
import 'core/data/services/event_tracker.dart';
import 'core/data/services/playback_position_cache.dart';
import 'core/data/services/playback_session.dart';
import 'core/data/services/reward_controller.dart';
import 'core/data/services/unlocked_episode_registry.dart';
import 'core/data/services/video_player_port.dart';
import 'core/data/services/wallet_controller.dart';
@@ -90,6 +93,7 @@ class LumaDramaApp extends StatefulWidget {
this.storeRepository,
this.searchRepository,
this.playlistRepository,
this.rewardRepository,
this.haptics = const FlutterHaptics(),
});
@@ -111,6 +115,7 @@ class LumaDramaApp extends StatefulWidget {
final StoreRepository? storeRepository;
final SearchRepository? searchRepository;
final PlaylistRepository? playlistRepository;
final RewardRepository? rewardRepository;
final Haptics haptics;
@override
@@ -179,6 +184,13 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
_commerceRepository,
);
late final RewardRepository _rewardRepository =
widget.rewardRepository ?? HttpRewardRepository(RewardApi(_apiClient));
late final RewardController _rewardController = RewardController(
_rewardRepository,
);
late final SearchRepository _searchRepository =
widget.searchRepository ?? HttpSearchRepository(CatalogApi(_apiClient));
@@ -249,6 +261,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
unawaited(_favoriteController.load());
_downloadController.reset();
_walletController.reset();
_rewardController.reset();
}
}
@@ -258,6 +271,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
_favoriteController.dispose();
_downloadController.dispose();
_walletController.dispose();
_rewardController.dispose();
_interactionController.dispose();
_localeController.dispose();
_appConfigController.dispose();
@@ -268,7 +282,9 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
CategoryController _createCategories() {
final controller = CategoryController(_categoryRepository);
if (widget.catalogRepository == null) {
controller.dramaPageLoader = CategoryApi(_apiClient).dramas;
final api = CategoryApi(_apiClient);
controller.dramaPageLoader = api.dramas;
controller.rankingLoader = api.ranking;
}
controller.load();
return controller;
@@ -311,6 +327,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
ChangeNotifierProvider.value(value: _favoriteController),
ChangeNotifierProvider.value(value: _downloadController),
ChangeNotifierProvider.value(value: _walletController),
ChangeNotifierProvider.value(value: _rewardController),
ChangeNotifierProvider.value(value: _interactionController),
ChangeNotifierProvider.value(value: _localeController),
ChangeNotifierProvider.value(value: _appConfigController),
+5 -5
View File
@@ -1,7 +1,5 @@
// Author: fruit.com.cn
import 'package:flutter/foundation.dart';
import 'dev_config.dart';
import 'prod_config.dart';
@@ -11,10 +9,12 @@ import 'prod_config.dart';
/// - `dev_config.dart`:[DevConfig](本机联调)
/// - `prod_config.dart`:[ProdConfig](生产)
///
/// Debug 使用开发环境,Release 自动使用生产环境,不做网络探测。
/// 切换环境只改下面这一个布尔值,不用传任何构建参数、也不做网络探测。
abstract final class AppConfig {
/// **环境开关**:Debug 使用开发环境,Release 使用生产环境。
static const bool useDevConfig = !kReleaseMode;
/// **环境开关**:true 用开发环境,false 用生产环境。
///
/// 打生产包前必须改成 false;release 构建若仍为 true 会在启动时直接报错。
static const bool useDevConfig = true;
/// 当前选中的环境地址。
static String get baseUrl =>
+1 -1
View File
@@ -6,5 +6,5 @@
/// 开发机的局域网 IP(真机上的 127.0.0.1 指向手机自己)。地址不要带结尾斜杠。
abstract final class DevConfig {
/// 开发机后端地址(Mac 当前 Wi-Fi 地址,换网络后需要同步修改)。
static const String baseUrl = 'http://192.168.31.243:8081';
static const String baseUrl = 'http://192.168.31.120:8081';
}
@@ -0,0 +1,67 @@
// Author: fruit.com.cn
import 'drama.dart';
import 'locale_text.dart';
/// 服务端推荐榜快照;顺序和排名均不可在客户端重算。
class CategoryRanking {
const CategoryRanking({
required this.id,
required this.code,
required this.revision,
required this.entries,
this.locales = const {},
this.generatedAt,
});
final String id;
final String code;
final String revision;
final Map<String, String> locales;
final DateTime? generatedAt;
final List<CategoryRankingEntry> entries;
/// 解析 `GET /app/categories/{id}/ranking`。
factory CategoryRanking.fromJson(Map<String, dynamic> json) {
final rawList = json['list'];
final entries = rawList is List
? rawList
.whereType<Map>()
.map(
(item) =>
CategoryRankingEntry.fromJson(item.cast<String, dynamic>()),
)
.toList(growable: false)
: const <CategoryRankingEntry>[];
return CategoryRanking(
id: (json['id'] ?? '').toString(),
code: json['code'] as String? ?? '',
revision: (json['revision'] ?? '1').toString(),
locales: localeMap(json['locales']),
generatedAt: DateTime.tryParse(json['generatedAt'] as String? ?? ''),
entries: entries,
);
}
}
/// 推荐榜中的一部短剧及其服务端排名。
class CategoryRankingEntry {
const CategoryRankingEntry({required this.rank, required this.drama});
final int rank;
final Drama drama;
factory CategoryRankingEntry.fromJson(Map<String, dynamic> json) {
final rawDrama = json['drama'];
return CategoryRankingEntry(
rank: (json['rank'] as num?)?.toInt() ?? 0,
drama: Drama.fromCardJson(
rawDrama is Map<String, dynamic>
? rawDrama
: rawDrama is Map
? rawDrama.cast<String, dynamic>()
: const <String, dynamic>{},
),
);
}
}
+19 -1
View File
@@ -7,10 +7,19 @@ class ContentCategory {
const ContentCategory({
required this.id,
required this.name,
this.code = '',
this.layoutType = gridLayout,
this.revision = '1',
this.locales = const {},
});
static const String gridLayout = 'GRID';
static const String rankingLayout = 'RANKING';
final String id;
final String code;
final String layoutType;
final String revision;
/// 中文名称,与 locales 里的 zh 相同。
final String name;
@@ -20,9 +29,18 @@ class ContentCategory {
factory ContentCategory.fromJson(Map<String, dynamic> json) {
final locales = localeMap(json['locales']);
final name = json['name'] as String? ?? locales['zh'] ?? '';
return ContentCategory(id: (json['id'] ?? '').toString(), name: name, locales: locales);
return ContentCategory(
id: (json['id'] ?? '').toString(),
name: name,
code: json['code'] as String? ?? '',
layoutType: json['layoutType'] as String? ?? gridLayout,
revision: (json['revision'] ?? '1').toString(),
locales: locales,
);
}
bool get isRanking => layoutType == rankingLayout;
/// 按界面语言取名称。缺对应语言时回落到中文。
String localizedName(String languageCode) {
return localizedText(languageCode, name, locales);
+242
View File
@@ -0,0 +1,242 @@
// Author: fruit.com.cn
import 'json_numbers.dart';
/// 奖励中心首屏数据。
class RewardOverview {
const RewardOverview({
required this.serverDate,
required this.timezone,
required this.coinBalance,
required this.checkin,
this.sections = const [],
this.activities = const [],
});
final String serverDate;
final String timezone;
final int coinBalance;
final RewardCheckinState checkin;
final List<RewardSection> sections;
final List<RewardActivity> activities;
factory RewardOverview.fromJson(Map<String, dynamic> json) {
return RewardOverview(
serverDate: json['serverDate'] as String? ?? '',
timezone: json['timezone'] as String? ?? '',
coinBalance: jsonToInt(json['coinBalance']),
checkin: RewardCheckinState.fromJson(_map(json['checkin'])),
sections: _maps(json['sections']).map(RewardSection.fromJson).toList(),
activities: _maps(
json['activities'],
).map(RewardActivity.fromJson).toList(),
);
}
}
/// 七日签到状态。
class RewardCheckinState {
const RewardCheckinState({
required this.taskId,
required this.checkedInToday,
required this.streak,
required this.currentDay,
this.days = const [],
});
final String taskId;
final bool checkedInToday;
final int streak;
final int currentDay;
final List<RewardCheckinDay> days;
factory RewardCheckinState.fromJson(Map<String, dynamic> json) {
return RewardCheckinState(
taskId: (json['taskId'] ?? '').toString(),
checkedInToday: json['checkedInToday'] == true,
streak: jsonToInt(json['streak']),
currentDay: jsonToInt(json['currentDay']),
days: _maps(json['days']).map(RewardCheckinDay.fromJson).toList(),
);
}
}
/// 签到周期中的一天。
class RewardCheckinDay {
const RewardCheckinDay({
required this.dayIndex,
required this.rewardCoin,
required this.checked,
required this.current,
});
final int dayIndex;
final int rewardCoin;
final bool checked;
final bool current;
factory RewardCheckinDay.fromJson(Map<String, dynamic> json) {
return RewardCheckinDay(
dayIndex: jsonToInt(json['dayIndex']),
rewardCoin: jsonToInt(json['rewardCoin']),
checked: json['checked'] == true,
current: json['current'] == true,
);
}
}
/// 一组奖励任务。
class RewardSection {
const RewardSection({
required this.code,
required this.title,
this.tasks = const [],
});
final String code;
final String title;
final List<RewardTask> tasks;
factory RewardSection.fromJson(Map<String, dynamic> json) {
return RewardSection(
code: json['code'] as String? ?? '',
title: json['title'] as String? ?? '',
tasks: _maps(json['tasks']).map(RewardTask.fromJson).toList(),
);
}
}
/// 奖励任务卡片。
class RewardTask {
const RewardTask({
required this.id,
required this.code,
required this.type,
required this.title,
required this.subtitle,
required this.ctaText,
required this.actionType,
required this.actionUrl,
required this.progressValue,
required this.targetValue,
required this.rewardCoin,
required this.status,
this.iconUrl = '',
});
final String id;
final String code;
final String type;
final String title;
final String subtitle;
final String ctaText;
final String actionType;
final String actionUrl;
final String iconUrl;
final int progressValue;
final int targetValue;
final int rewardCoin;
final String status;
bool get claimable => status == 'COMPLETED';
bool get claimed => status == 'CLAIMED';
double get progress =>
targetValue <= 0 ? 0 : (progressValue / targetValue).clamp(0.0, 1.0);
factory RewardTask.fromJson(Map<String, dynamic> json) {
return RewardTask(
id: (json['id'] ?? '').toString(),
code: json['code'] as String? ?? '',
type: json['type'] as String? ?? '',
title: json['title'] as String? ?? '',
subtitle: json['subtitle'] as String? ?? '',
ctaText: json['ctaText'] as String? ?? '',
actionType: json['actionType'] as String? ?? '',
actionUrl: json['actionUrl'] as String? ?? '',
iconUrl: json['iconUrl'] as String? ?? '',
progressValue: jsonToInt(json['progressValue']),
targetValue: jsonToInt(json['targetValue']),
rewardCoin: jsonToInt(json['rewardCoin']),
status: json['status'] as String? ?? 'IN_PROGRESS',
);
}
}
/// 奖励活动展示卡片。
class RewardActivity {
const RewardActivity({
required this.id,
required this.code,
required this.title,
required this.summary,
required this.ctaText,
required this.actionType,
required this.actionUrl,
this.coverUrl = '',
});
final String id;
final String code;
final String title;
final String summary;
final String ctaText;
final String actionType;
final String actionUrl;
final String coverUrl;
factory RewardActivity.fromJson(Map<String, dynamic> json) {
return RewardActivity(
id: (json['id'] ?? '').toString(),
code: json['code'] as String? ?? '',
title: json['title'] as String? ?? '',
summary: json['summary'] as String? ?? '',
ctaText: json['ctaText'] as String? ?? '',
actionType: json['actionType'] as String? ?? '',
actionUrl: json['actionUrl'] as String? ?? '',
coverUrl: json['coverUrl'] as String? ?? '',
);
}
}
/// 签到或任务领取后的余额变化结果。
class RewardActionResult {
const RewardActionResult({
required this.rewardCoin,
required this.coinBalance,
required this.alreadyCompleted,
});
final int rewardCoin;
final int coinBalance;
final bool alreadyCompleted;
factory RewardActionResult.fromCheckin(Map<String, dynamic> json) {
return RewardActionResult(
rewardCoin: jsonToInt(json['rewardCoin']),
coinBalance: jsonToInt(json['coinBalance']),
alreadyCompleted: json['alreadyCheckedIn'] == true,
);
}
factory RewardActionResult.fromClaim(Map<String, dynamic> json) {
return RewardActionResult(
rewardCoin: jsonToInt(json['rewardCoin']),
coinBalance: jsonToInt(json['coinBalance']),
alreadyCompleted: json['alreadyGranted'] == true,
);
}
}
Map<String, dynamic> _map(Object? value) {
if (value is Map<String, dynamic>) return value;
if (value is Map) return value.cast<String, dynamic>();
return const {};
}
List<Map<String, dynamic>> _maps(Object? value) {
if (value is! List) return const [];
return value
.whereType<Map>()
.map((item) => item.cast<String, dynamic>())
.toList();
}
+23
View File
@@ -125,6 +125,29 @@ class AuthApi {
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
}
/// Google 登录:把客户端拿到的 idToken 交给后端校验并换发令牌。
///
/// 账号按 Google 返回的邮箱归并:邮箱已存在则直接登入,不存在则自动建号。
Future<AuthSession> googleLogin({
required String idToken,
required String deviceId,
String platform = '',
String osVersion = '',
String appVersion = '',
}) async {
final data = await _client.post(
'/app/auth/google',
body: {
'idToken': idToken,
'deviceId': deviceId,
'platform': platform,
'osVersion': osVersion,
'appVersion': appVersion,
},
);
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
}
Future<AuthSession> refresh(
String refreshToken, {
String platform = '',
+8 -4
View File
@@ -1,6 +1,7 @@
// Author: fruit.com.cn
import '../models/content_category.dart';
import '../models/category_ranking.dart';
import '../models/drama.dart';
import '../models/page_result.dart';
import 'api_client.dart';
@@ -30,11 +31,14 @@ class CategoryApi {
}) async {
final data = await _client.get(
'/app/categories/$categoryId/dramas',
query: {
'pageIndex': '$pageIndex',
'pageSize': '$pageSize',
},
query: {'pageIndex': '$pageIndex', 'pageSize': '$pageSize'},
);
return PageResult.parse(data, Drama.fromCardJson);
}
/// 推荐榜快照,服务端已确定内容顺序和连续排名。
Future<CategoryRanking> ranking(String categoryId) async {
final data = await _client.get('/app/categories/$categoryId/ranking');
return CategoryRanking.fromJson(ResponseDecoders.asMap(data));
}
}
+30
View File
@@ -0,0 +1,30 @@
// Author: fruit.com.cn
import '../models/reward.dart';
import 'api_client.dart';
import 'response_decoders.dart';
/// 奖励中心接口,对应契约 §1.8.1。
class RewardApi {
const RewardApi(this._client);
final ApiClient _client;
Future<RewardOverview> overview(String locale) async {
final data = await _client.get(
'/app/rewards/overview',
query: {'locale': locale},
);
return RewardOverview.fromJson(ResponseDecoders.asMap(data));
}
Future<RewardActionResult> checkIn() async {
final data = await _client.post('/app/rewards/check-in');
return RewardActionResult.fromCheckin(ResponseDecoders.asMap(data));
}
Future<RewardActionResult> claim(String taskId) async {
final data = await _client.post('/app/rewards/tasks/$taskId/claim');
return RewardActionResult.fromClaim(ResponseDecoders.asMap(data));
}
}
@@ -0,0 +1,29 @@
// Author: fruit.com.cn
import '../models/reward.dart';
import '../remote/reward_api.dart';
/// 奖励中心数据来源。
abstract interface class RewardRepository {
Future<RewardOverview> fetchOverview(String locale);
Future<RewardActionResult> checkIn();
Future<RewardActionResult> claim(String taskId);
}
/// 奖励中心 HTTP 仓库。
class HttpRewardRepository implements RewardRepository {
const HttpRewardRepository(this._api);
final RewardApi _api;
@override
Future<RewardOverview> fetchOverview(String locale) => _api.overview(locale);
@override
Future<RewardActionResult> checkIn() => _api.checkIn();
@override
Future<RewardActionResult> claim(String taskId) => _api.claim(taskId);
}
@@ -103,6 +103,17 @@ class AuthController extends ChangeNotifier {
await _apply(session);
}
/// Google 登录:把 Google 返回的 idToken 交给后端校验并落登录态。
Future<void> signInWithGoogle(String idToken) async {
final session = await _api.googleLogin(
idToken: idToken,
deviceId: await _store.deviceId(),
platform: _platform,
osVersion: _osVersion,
);
await _apply(session);
}
Future<void> clear() async {
_session = null;
await _store.clear();
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import '../../config/app_config.dart';
import '../models/content_category.dart';
import '../models/category_ranking.dart';
import '../models/drama.dart';
import '../models/home_feed.dart';
import '../models/page_result.dart';
@@ -21,10 +22,15 @@ class CategoryController extends ChangeNotifier {
String categoryId, {
int pageIndex,
int pageSize,
})? dramaPageLoader;
})?
dramaPageLoader;
/// 生产环境推荐榜加载器,测试与本地数据模式可不注入。
Future<CategoryRanking> Function(String categoryId)? rankingLoader;
List<ContentCategory> categories = const [];
final Map<String, CategoryDramaSlot> _slots = {};
final Map<String, CategoryRankingSlot> _rankingSlots = {};
HomeFeed feed = const HomeFeed();
bool loading = false;
String? error;
@@ -36,6 +42,29 @@ class CategoryController extends ChangeNotifier {
return _slots.putIfAbsent(categoryId, CategoryDramaSlot.new);
}
CategoryRankingSlot rankingSlotOf(String categoryId) {
return _rankingSlots.putIfAbsent(categoryId, CategoryRankingSlot.new);
}
/// 打开推荐榜并获取当前服务端快照。
Future<void> openRanking(String categoryId) async {
final loader = rankingLoader;
if (loader == null) return;
final slot = rankingSlotOf(categoryId);
slot.loading = true;
slot.error = null;
_notify();
try {
slot.ranking = await loader(categoryId);
} catch (exception) {
slot.error = exception;
if (kDebugMode) debugPrint('[category-ranking] $exception');
} finally {
slot.loading = false;
_notify();
}
}
/// 打开分类并加载第一页短剧。
Future<void> openCategory(String categoryId) async {
final loader = dramaPageLoader;
@@ -126,8 +155,14 @@ class CategoryController extends ChangeNotifier {
loading = false;
_notify();
}
if (error == null && dramaPageLoader != null && categories.isNotEmpty) {
await openCategory(categories.first.id);
final hasRemoteLoader = dramaPageLoader != null || rankingLoader != null;
if (error == null && hasRemoteLoader && categories.isNotEmpty) {
final first = categories.first;
if (first.isRanking) {
await openRanking(first.id);
} else {
await openCategory(first.id);
}
}
}
@@ -152,3 +187,10 @@ class CategoryDramaSlot {
bool get hasMore => dramas.length < total;
}
/// 单个推荐榜的快照状态。
class CategoryRankingSlot {
CategoryRanking? ranking;
Object? error;
bool loading = false;
}
@@ -120,7 +120,9 @@ class DownloadController extends ChangeNotifier {
String episodeId, {
DownloadLicense? license,
}) async {
if (_downloading.contains(episodeId)) return const DownloadActionResult(ok: true);
if (_downloading.contains(episodeId)) {
return const DownloadActionResult(ok: true);
}
final source = license ?? _licenseFor(episodeId);
if (source == null) return const DownloadActionResult(ok: false);
_beginDownload(episodeId);
@@ -129,7 +131,8 @@ class DownloadController extends ChangeNotifier {
final media = await _storage.download(
episodeId: episodeId,
url: resolved,
onProgress: (received, total) => _onProgress(episodeId, received, total),
onProgress: (received, total) =>
_onProgress(episodeId, received, total),
);
_localPaths[episodeId] = media.filePath;
_progress[episodeId] = 1;
@@ -0,0 +1,121 @@
// Author: fruit.com.cn
import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
import 'package:google_sign_in/google_sign_in.dart';
/// Google 授权结局。
///
/// 插件调用与 IO 一样用结果对象返回,不把异常抛到页面:
/// 页面只需要区分"成功 / 用户取消 / 不可用 / 失败"四种情况。
class GoogleSignInOutcome {
const GoogleSignInOutcome._({
this.idToken,
this.canceled = false,
this.unavailable = false,
this.failed = false,
});
/// 成功拿到可交给后端校验的 idToken。
const GoogleSignInOutcome.success(String idToken) : this._(idToken: idToken);
/// 用户主动取消授权,页面不应提示错误。
const GoogleSignInOutcome.canceled() : this._(canceled: true);
/// 当前平台或构建不支持交互式登录。
const GoogleSignInOutcome.unavailable() : this._(unavailable: true);
/// 授权过程失败(网络、配置缺失、Google 拒绝等)。
const GoogleSignInOutcome.failed() : this._(failed: true);
/// Google 返回的 idToken;未成功时为 null。
final String? idToken;
/// 用户是否主动取消。
final bool canceled;
/// 平台是否不支持。
final bool unavailable;
/// 是否失败。
final bool failed;
/// 是否拿到了可用的 idToken。
bool get isSuccess => idToken != null && idToken!.isNotEmpty;
}
/// Google 登录客户端封装。
///
/// 只负责拉起 Google 授权并取出 idToken;换发本应用令牌由 AuthController 完成,
/// 插件调用与网络层各自独立,页面通过 [GoogleSignInOutcome] 判断结局。
class GoogleAuthService {
GoogleAuthService({GoogleSignIn? signIn})
: _signIn = signIn ?? GoogleSignIn.instance;
/// Android 必须显式传 serverClientId 才会返回 idToken,且要传 Web 客户端 id;
/// iOS 由 Info.plist 的 GIDClientID 决定,无需再传。
static const String _serverClientId =
'11115008580-dbqe47fhp5560nhrocrppiq7hcnlvl1s.apps.googleusercontent.com';
/// 授权等待上限:插件在账号被撤销后可能永不返回,必须有超时兜底,
/// 否则页面 loading 状态会一直卡住、按钮再也点不动。
static const Duration _authTimeout = Duration(seconds: 60);
final GoogleSignIn _signIn;
bool _initialized = false;
/// 拉起授权并返回结局;不会抛异常。
Future<GoogleSignInOutcome> signIn() async {
try {
await _ensureInitialized();
if (!_signIn.supportsAuthenticate()) {
return const GoogleSignInOutcome.unavailable();
}
// 先清掉插件缓存的旧账号:用户可能在 Google 侧撤销过授权或切换过账号,
// 残留状态会让 authenticate 直接返回失效账号或干脆不弹授权页。
await _clearStaleAccount();
final account = await _signIn.authenticate().timeout(_authTimeout);
final idToken = account.authentication.idToken;
if (idToken == null || idToken.isEmpty) {
return const GoogleSignInOutcome.failed();
}
return GoogleSignInOutcome.success(idToken);
} on TimeoutException {
await _clearStaleAccount();
return const GoogleSignInOutcome.failed();
} on GoogleSignInException catch (error) {
if (error.code == GoogleSignInExceptionCode.canceled) {
return const GoogleSignInOutcome.canceled();
}
// 失败多半是插件缓存了已失效的账号(用户手动撤销授权、换账号),
// 清掉本地状态,下次点击才能重新拉起授权页。
await _clearStaleAccount();
return const GoogleSignInOutcome.failed();
} catch (_) {
await _clearStaleAccount();
return const GoogleSignInOutcome.failed();
}
}
/// 清掉插件缓存的 Google 账号;失败不影响登录结果,异常直接吞掉。
Future<void> _clearStaleAccount() async {
try {
await _signIn.signOut();
} catch (_) {
// 忽略:清缓存失败不应阻断页面恢复
}
}
/// 插件要求先 initialize 才能 authenticate;只做一次。
Future<void> _ensureInitialized() async {
if (_initialized) return;
await _signIn.initialize(
serverClientId: _isAndroid ? _serverClientId : null,
);
_initialized = true;
}
bool get _isAndroid => !kIsWeb && Platform.isAndroid;
}
@@ -0,0 +1,108 @@
// Author: fruit.com.cn
import 'package:flutter/foundation.dart';
import '../models/reward.dart';
import '../remote/api_exception.dart';
import '../repositories/reward_repository.dart';
/// 奖励中心状态与签到、领取动作。
class RewardController extends ChangeNotifier {
RewardController(this._repository);
final RewardRepository _repository;
RewardOverview? overview;
bool loading = false;
bool checkingIn = false;
String? claimingTaskId;
String? error;
String? actionError;
bool _disposed = false;
String _locale = 'id';
Future<void> load(String locale) async {
if (_disposed || loading) return;
_locale = locale;
loading = true;
error = null;
_notify();
try {
overview = await _repository.fetchOverview(locale);
} on ApiException catch (exception) {
error = exception.message;
} catch (_) {
error = 'rewardLoadFailed';
} finally {
loading = false;
_notify();
}
}
/// 签到成功后刷新总览,确保签到格和余额来自服务端事实。
Future<RewardActionResult?> checkIn() async {
if (_disposed || checkingIn) return null;
checkingIn = true;
actionError = null;
_notify();
try {
final result = await _repository.checkIn();
await _reload();
return result;
} on ApiException catch (exception) {
actionError = exception.message;
return null;
} catch (_) {
actionError = 'rewardActionFailed';
return null;
} finally {
checkingIn = false;
_notify();
}
}
/// 领取任务奖励;同一时刻只允许一个领取动作。
Future<RewardActionResult?> claim(String taskId) async {
if (_disposed || claimingTaskId != null) return null;
claimingTaskId = taskId;
actionError = null;
_notify();
try {
final result = await _repository.claim(taskId);
await _reload();
return result;
} on ApiException catch (exception) {
actionError = exception.message;
return null;
} catch (_) {
actionError = 'rewardActionFailed';
return null;
} finally {
claimingTaskId = null;
_notify();
}
}
void reset() {
overview = null;
loading = false;
checkingIn = false;
claimingTaskId = null;
error = null;
actionError = null;
_notify();
}
Future<void> _reload() async {
overview = await _repository.fetchOverview(_locale);
}
void _notify() {
if (!_disposed) notifyListeners();
}
@override
void dispose() {
_disposed = true;
super.dispose();
}
}
+29 -13
View File
@@ -30,6 +30,12 @@ abstract final class AppColors {
/// 首页及剧集播放页视频信息文案:参考设计图的 65% 半透明白。
static const homeFeedVideoCopy = Color(0xA6FFFFFF);
/// 首页观看全集按钮:与浮层玻璃语言一致的半透明白表面。
static const watchAllSurface = Color(0x26FFFFFF);
/// 观看全集按钮的极淡白色轮廓。
static const watchAllBorder = Color(0x0FFFFFFF);
/// 主操作、选中态、播放进度。旧品牌橙已全量映射为品牌红(2026-10 改版)。
static const blue = Color(0xFFF04E4E);
static const primary = blue;
@@ -51,20 +57,23 @@ abstract final class AppColors {
static const vipGoldStart = Color(0xFFF5D9A0);
static const vipGoldEnd = Color(0xFFE8B65A);
/// 「我的」页 VIP 卡:品牌酒红、暖黑与香槟金共同形成会员层级。
static const vipCardStart = Color(0xFF351318);
static const vipCardMiddle = Color(0xFF1B1112);
static const vipCardEnd = Color(0xFF0D0B0C);
static const vipCardBorder = Color(0x66F5D9A0);
static const vipCardRedGlow = Color(0x52F04E4E);
static const vipCardGoldGlow = Color(0x38F3B34C);
static const vipCardText = Color(0xFFFFF5E6);
static const vipCardMuted = Color(0xB3F5D9A0);
static const vipBadgeSurface = Color(0x24FFFFFF);
/// 「我的」页 VIP 卡:品牌红、暖黑与中性灰形成统一层级。
static const vipCardStart = Color(0xFF21191C);
static const vipCardMiddle = Color(0xFF181719);
static const vipCardEnd = Color(0xFF141416);
static const vipCardBorder = Color(0x2EFFFFFF);
static const vipCardRedGlow = Color(0x2EF04E4E);
static const vipCardGoldGlow = Color(0x16F5D9A0);
static const vipArtGlow = Color(0x55F04E4E);
static const vipArtStart = Color(0xFFE45757);
static const vipArtEnd = Color(0xFF6E1F2D);
static const vipCardText = Color(0xFFF5F5F7);
static const vipCardMuted = Color(0xB3B0B0B0);
static const vipBadgeSurface = Color(0x24F04E4E);
static const vipBenefitSurface = Color(0x12FFFFFF);
static const vipBenefitBorder = Color(0x33F5D9A0);
static const vipButtonStart = brandRed;
static const vipButtonEnd = Color(0xFFFF745E);
static const vipBenefitBorder = Color(0x14FFFFFF);
static const vipButtonStart = Color(0xFFF04E4E);
static const vipButtonEnd = Color(0xFFC93648);
static const bronze = Color(0xFFCD7F32);
static const bronzeDeep = Color(0xFFA9713A);
static const rankSilver = Color(0xFFC0C0C0);
@@ -176,6 +185,7 @@ abstract final class AppColors {
static const navBackground = Color(0xFF000000);
static const brandRed = Color(0xFFF04E4E);
static const brandRedPressed = Color(0xFFD64040);
static const navSelectedGlow = Color(0x33F04E4E);
static const navSelected = brandRed;
/// 卡片阴影(深色几乎不用阴影)。
@@ -216,6 +226,12 @@ abstract final class AppColors {
/// 玻璃面板描边。
static const glassBorder = Color(0x33FFFFFF);
/// 玻璃控件使用的发丝级轮廓,避免边缘抢过内容。
static const glassHairline = Color(0x12FFFFFF);
/// 轻量玻璃控件的白色表面。
static const glassSurface = Color(0x24FFFFFF);
static const glassSurfaceStart = Color(0xEB16161A);
static const glassSurfaceEnd = Color(0xD1101010);
+20 -24
View File
@@ -21,7 +21,7 @@ abstract final class AppDimens {
static const double buttonRadius = 10;
static const double inputRadius = 10;
static const double chipRadius = 6;
static const double coverRadius = 12;
static const double coverRadius = 8;
static const double sheetRadius = 12;
static const double caption = 12;
@@ -92,7 +92,7 @@ abstract final class AppDimens {
static const double homeGridGap = 6;
static const double homeGridRowGap = 10;
static const double homeCardRadius = 6;
static const double cardCoverRadius = 8;
static const double cardCoverRadius = coverRadius;
static const double homeCardPadding = 8;
static const double cardTitleFont = 15;
static const double cardTitleLineHeight = 1.3;
@@ -157,17 +157,9 @@ abstract final class AppDimens {
/// 首页热播榜。
static const double rankingHeroTitle = 22;
static const double rankingHeroSubtitle = 11;
static const double rankingPodiumChampionWidth = 110;
static const double rankingPodiumChampionHeight = 146;
static const double rankingPodiumWidth = 92;
static const double rankingPodiumHeight = 122;
static const double rankingPodiumRadius = 10;
static const double rankingRowHeight = 96;
static const double rankingNumberWidth = 56;
static const double rankingNumberFont = 48;
static const double rankingCoverWidth = 60;
static const double rankingCoverHeight = 80;
static const double rankingCoverRadius = 6;
static const double rankingCoverRadius = coverRadius;
static const double rankingCardCoverWidth = 96;
static const double rankingCardCoverHeight = 128;
/// 全部短剧筛选与追剧双列。
static const double filterChipFont = 16;
@@ -197,7 +189,7 @@ abstract final class AppDimens {
static const double followingProgressHeight = 2;
static const double followingHistoryCoverWidth = 96;
static const double followingHistoryCoverHeight = 128;
static const double followingHistoryCoverRadius = 6;
static const double followingHistoryCoverRadius = coverRadius;
static const double followingHistoryContentGap = 12;
static const double followingHistoryRowGap = 16;
static const double followingHistoryProgressHeight = 3;
@@ -281,20 +273,24 @@ abstract final class AppDimens {
static const double mineSectionLinkFont = 12;
static const double mineSectionGap = 12;
/// 「我的」页会员卡。高度由内容撑开,上下内边距恒为 [mineVipPadding]。
/// 「我的」页紧凑会员横幅尺寸。
static const double mineVipRadius = 18;
static const double mineVipPadding = 16;
static const double mineVipTitleFont = 22;
static const double mineVipSubtitleFont = 12;
static const double mineVipPadding = 10;
static const double mineVipTitleFont = 21;
static const double mineVipSubtitleFont = 11;
static const double mineVipEmblem = 48;
static const double mineVipEmblemIcon = 28;
static const double mineVipActionWidth = 100;
static const double mineVipArtWidth = 84;
static const double mineVipArtHeight = 84;
static const double mineVipArtGlow = 56;
static const double mineVipArtSurface = 44;
static const double mineVipArtIcon = 22;
static const double mineVipActionWidth = 86;
static const double mineVipBenefitFont = 10.5;
static const double mineVipBenefitBox = 34;
static const double mineVipBenefitBoxRadius = 11;
static const double mineVipBenefitGlyph = 19;
static const double mineVipBenefitRowGap = 6;
static const double mineVipButtonHeight = tapTarget;
static const double mineVipBenefitSurface = 28;
static const double mineVipBenefitGlyph = 16;
static const double mineVipBenefitRowGap = 2;
static const double mineVipButtonHeight = 26;
static const double mineContinueCardWidth = 96;
static const double mineContinueRowHeight = 172;
static const double mineContinueTitleFont = 13;
+40 -28
View File
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
import '../theme/app_dimens.dart';
import 'app_press_scale.dart';
const double _maxNavigationTextScale = 1.3;
@@ -32,7 +33,7 @@ class AppBottomNavItem {
final bool selected;
}
/// 四槽底部导航:纯黑背景,白色选中态,灰色未选中态。
/// 均分底部导航:纯黑背景,品牌红选中态,白色未选中态。
class AppBottomNav extends StatelessWidget {
const AppBottomNav({super.key, required this.items, this.barKey});
@@ -91,35 +92,46 @@ class _NavDestination extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedScale(
duration: const Duration(milliseconds: 160),
curve: Curves.easeOut,
scale: item.selected ? 1 : 0.96,
child:
item.customIcon ??
(assetPath == null
? Icon(
fallbackIcon,
size: AppDimens.navIcon,
color: color,
)
: ColorFiltered(
colorFilter: ColorFilter.mode(
color,
BlendMode.srcIn,
AppPressScale(
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(AppDimens.navIcon),
boxShadow: item.selected
? const [
BoxShadow(
color: AppColors.navSelectedGlow,
blurRadius: 12,
spreadRadius: 1,
),
child: Image.asset(
assetPath,
width: AppDimens.navIcon,
height: AppDimens.navIcon,
fit: BoxFit.contain,
errorBuilder: (_, _, _) => Icon(
fallbackIcon,
size: AppDimens.navIcon,
color: color,
]
: const [],
),
child:
item.customIcon ??
(assetPath == null
? Icon(
fallbackIcon,
size: AppDimens.navIcon,
color: color,
)
: ColorFiltered(
colorFilter: ColorFilter.mode(
color,
BlendMode.srcIn,
),
),
)),
child: Image.asset(
assetPath,
width: AppDimens.navIcon,
height: AppDimens.navIcon,
fit: BoxFit.contain,
errorBuilder: (_, _, _) => Icon(
fallbackIcon,
size: AppDimens.navIcon,
color: color,
),
),
)),
),
),
const SizedBox(height: AppDimens.navLabelGap),
Text(
+53
View File
@@ -0,0 +1,53 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
const double _pressedScale = 0.97;
/// 为可点击内容提供轻量、短促的按压缩放反馈。
class AppPressScale extends StatefulWidget {
const AppPressScale({
super.key,
required this.child,
this.onTap,
this.scale = _pressedScale,
});
final Widget child;
final VoidCallback? onTap;
final double scale;
@override
State<AppPressScale> createState() => _AppPressScaleState();
}
class _AppPressScaleState extends State<AppPressScale> {
bool _pressed = false;
void _setPressed(bool pressed) {
if (_pressed == pressed) {
return;
}
setState(() => _pressed = pressed);
}
@override
Widget build(BuildContext context) {
final scale = _pressed ? widget.scale : 1.0;
final feedback = Listener(
behavior: HitTestBehavior.translucent,
onPointerDown: (_) => _setPressed(true),
onPointerUp: (_) => _setPressed(false),
onPointerCancel: (_) => _setPressed(false),
child: Transform.scale(scale: scale, child: widget.child),
);
if (widget.onTap == null) {
return feedback;
}
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: widget.onTap,
child: feedback,
);
}
}
+6 -1
View File
@@ -11,6 +11,7 @@ const double _maxPullDistance = 96;
const double _refreshThreshold = 56;
const double _indicatorHeight = 56;
const double _indicatorDisplacement = 40;
const double _indicatorTopPadding = 8;
const Duration _settleDuration = Duration(milliseconds: 200);
enum _PullState { idle, pull, armed, refreshing }
@@ -27,6 +28,10 @@ class AppPullToRefresh extends StatefulWidget {
static const AlwaysScrollableScrollPhysics physics =
AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics());
/// 达到刷新阈值时,指示器顶部相对容器顶部的下移距离。
static const double indicatorRevealOffset =
_indicatorDisplacement + _indicatorTopPadding;
final Widget child;
final Future<void> Function() onRefresh;
final double edgeOffset;
@@ -191,7 +196,7 @@ class _AppPullToRefreshState extends State<AppPullToRefresh>
child: Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.only(top: 8),
padding: const EdgeInsets.only(top: _indicatorTopPadding),
child: _indicator(),
),
),
+7 -1
View File
@@ -11,6 +11,7 @@ import 'root_nav_glyph.dart';
enum AppRootTab {
home(),
recommend(),
reward(),
following(),
mine();
@@ -21,6 +22,7 @@ extension AppRootTabUi on AppRootTab {
RootNavGlyphKind get glyphKind => switch (this) {
AppRootTab.home => RootNavGlyphKind.home,
AppRootTab.recommend => RootNavGlyphKind.recommend,
AppRootTab.reward => RootNavGlyphKind.reward,
AppRootTab.following => RootNavGlyphKind.following,
AppRootTab.mine => RootNavGlyphKind.mine,
};
@@ -28,6 +30,7 @@ extension AppRootTabUi on AppRootTab {
Key get tabKey => switch (this) {
AppRootTab.home => const Key('tab-home'),
AppRootTab.recommend => const Key('tab-recommend'),
AppRootTab.reward => const Key('tab-reward'),
AppRootTab.following => const Key('tab-follow'),
AppRootTab.mine => const Key('tab-mine'),
};
@@ -35,6 +38,7 @@ extension AppRootTabUi on AppRootTab {
IconData get icon => switch (this) {
AppRootTab.home => Icons.home_outlined,
AppRootTab.recommend => Icons.smart_display_outlined,
AppRootTab.reward => Icons.card_giftcard_outlined,
AppRootTab.following => Icons.bookmark_border_rounded,
AppRootTab.mine => Icons.person_outline_rounded,
};
@@ -42,6 +46,7 @@ extension AppRootTabUi on AppRootTab {
IconData get selectedIcon => switch (this) {
AppRootTab.home => Icons.home_rounded,
AppRootTab.recommend => Icons.smart_display_rounded,
AppRootTab.reward => Icons.card_giftcard_rounded,
AppRootTab.following => Icons.bookmark_rounded,
AppRootTab.mine => Icons.person_rounded,
};
@@ -49,12 +54,13 @@ extension AppRootTabUi on AppRootTab {
String label(AppLocalizations l10n) => switch (this) {
AppRootTab.home => l10n.homeTab,
AppRootTab.recommend => l10n.recommendedTab,
AppRootTab.reward => l10n.rewardTab,
AppRootTab.following => l10n.followingTab,
AppRootTab.mine => l10n.myTab,
};
}
/// 根导航唯一入口,确保四个主页面使用完全一致的底栏配置。
/// 根导航唯一入口,确保五个主页面使用完全一致的底栏配置。
class AppRootBottomNav extends StatelessWidget {
const AppRootBottomNav({
super.key,
+1 -1
View File
@@ -168,7 +168,7 @@ class _SkeletonBlock extends StatelessWidget {
return DecoratedBox(
decoration: BoxDecoration(
color: AppColors.skeletonSurface,
borderRadius: BorderRadius.circular(AppDimens.homeCardRadius),
borderRadius: BorderRadius.circular(AppDimens.coverRadius),
),
);
}
+40 -27
View File
@@ -5,12 +5,12 @@ import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
import '../theme/app_dimens.dart';
const double _regularIconSize = 72;
const double _compactIconSize = 44;
const double _iconSize = 72;
const double _maxContentWidth = 260;
const double _regularHorizontal = 24;
const double _regularVertical = 28;
const double _compactPad = 16;
const double _compactHorizontal = 16;
const double _compactVertical = 4;
const double _regularGap = 20;
const double _compactGap = 12;
const double _actionMinHeight = 44;
@@ -27,6 +27,7 @@ class EmptyState extends StatelessWidget {
this.onAction,
this.footer,
this.compact = false,
this.stretchContent = false,
});
final IconData icon;
@@ -38,6 +39,9 @@ class EmptyState extends StatelessWidget {
final Widget? footer;
final bool compact;
/// 让图标和文案占满内容宽度,适用于需要严格居中的宽版空状态。
final bool stretchContent;
@override
Widget build(BuildContext context) {
final hasAction = actionLabel != null && onAction != null;
@@ -48,28 +52,33 @@ class EmptyState extends StatelessWidget {
child: Padding(
key: const Key('empty-state-padding'),
padding: EdgeInsets.symmetric(
horizontal: compact ? _compactPad : _regularHorizontal,
vertical: compact ? _compactPad : _regularVertical,
horizontal: compact ? _compactHorizontal : _regularHorizontal,
vertical: compact ? _compactVertical : _regularVertical,
),
child: Semantics(
container: true,
label: title,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ExcludeSemantics(
child: _EmptyMark(icon: icon, compact: compact),
),
SizedBox(height: compact ? _compactGap : _regularGap),
_EmptyCopy(
title: title,
subtitle: subtitle,
actionLabel: hasAction ? actionLabel : null,
actionKey: actionKey,
onAction: hasAction ? onAction : null,
footer: footer,
),
],
child: SizedBox(
width: stretchContent ? double.infinity : null,
child: Semantics(
container: true,
label: title,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ExcludeSemantics(child: _EmptyMark(icon: icon)),
SizedBox(height: compact ? _compactGap : _regularGap),
SizedBox(
width: stretchContent ? double.infinity : null,
child: _EmptyCopy(
title: title,
subtitle: subtitle,
actionLabel: hasAction ? actionLabel : null,
actionKey: actionKey,
onAction: hasAction ? onAction : null,
footer: footer,
stretchContent: stretchContent,
),
),
],
),
),
),
),
@@ -80,17 +89,16 @@ class EmptyState extends StatelessWidget {
/// 空列表只放一枚大图标,不画线框,也不铺底色。
class _EmptyMark extends StatelessWidget {
const _EmptyMark({required this.icon, required this.compact});
const _EmptyMark({required this.icon});
final IconData icon;
final bool compact;
@override
Widget build(BuildContext context) {
return Icon(
icon,
key: const Key('empty-state-icon'),
size: compact ? _compactIconSize : _regularIconSize,
size: _iconSize,
color: AppColors.subtle,
);
}
@@ -104,6 +112,7 @@ class _EmptyCopy extends StatelessWidget {
required this.actionKey,
required this.onAction,
required this.footer,
required this.stretchContent,
});
final String title;
@@ -112,11 +121,15 @@ class _EmptyCopy extends StatelessWidget {
final Key? actionKey;
final VoidCallback? onAction;
final Widget? footer;
final bool stretchContent;
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: stretchContent
? CrossAxisAlignment.stretch
: CrossAxisAlignment.center,
children: [
ExcludeSemantics(
child: Text(
@@ -1,86 +0,0 @@
// Author: fruit.com.cn
// 职责:给默认图片加载占位叠加可暂停、局部重绘的轻量扫光。
import 'package:flutter/material.dart';
const _sweepDuration = Duration(milliseconds: 1400);
const double _bandWidthRatio = 0.65;
const _highlight = Color(0x12FFFFFF);
const _clear = Color(0x00FFFFFF);
/// 只用于等待真实图片的占位;减少动画或页面离屏时不运行扫光。
class ImagePlaceholderShimmer extends StatefulWidget {
/// 在 [child] 上方绘制不影响布局与点击区域的扫光。
const ImagePlaceholderShimmer({super.key, required this.child});
final Widget child;
@override
State<ImagePlaceholderShimmer> createState() =>
_ImagePlaceholderShimmerState();
}
class _ImagePlaceholderShimmerState extends State<ImagePlaceholderShimmer>
with SingleTickerProviderStateMixin {
late final AnimationController _controller = AnimationController(
vsync: this,
duration: _sweepDuration,
);
bool _active = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
_active =
TickerMode.valuesOf(context).enabled &&
!MediaQuery.disableAnimationsOf(context);
if (_active) {
_controller.repeat();
} else {
_controller.stop();
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (!_active) return widget.child;
return RepaintBoundary(
child: ClipRect(
child: CustomPaint(
foregroundPainter: _SweepPainter(_controller),
child: widget.child,
),
),
);
}
}
class _SweepPainter extends CustomPainter {
_SweepPainter(this.progress) : super(repaint: progress);
final Animation<double> progress;
@override
void paint(Canvas canvas, Size size) {
if (size.isEmpty) return;
final bandWidth = size.width * _bandWidthRatio;
final left = -bandWidth + (size.width + bandWidth) * progress.value;
final rect = Rect.fromLTWH(left, 0, bandWidth, size.height);
final paint = Paint()
..shader = const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [_clear, _highlight, _clear],
).createShader(rect);
canvas.drawRect(rect, paint);
}
@override
bool shouldRepaint(covariant _SweepPainter oldDelegate) =>
oldDelegate.progress != progress;
}
+11 -43
View File
@@ -1,10 +1,10 @@
// Author: fruit.com.cn
// 职责:统一网络图片入口,补服务地址,并在加载中/失败时显示纯色占位块。
import 'package:flutter/material.dart';
import '../config/app_config.dart';
import '../theme/app_colors.dart';
import 'image_placeholder_shimmer.dart';
const int _minImageDecodePixels = 96;
const int _maxImageDecodePixels = 2048;
@@ -32,8 +32,6 @@ class RemoteImage extends StatelessWidget {
this.width,
this.height,
this.fit = BoxFit.cover,
this.showFallbackIcon = false,
this.fallbackIconKey,
this.fallbackAspectRatio,
this.fallbackColor = AppColors.raised,
this.fallbackWidget,
@@ -45,12 +43,10 @@ class RemoteImage extends StatelessWidget {
final double? width;
final double? height;
final BoxFit fit;
final bool showFallbackIcon;
final Key? fallbackIconKey;
final double? fallbackAspectRatio;
final Color fallbackColor;
/// 自定义兜底:地址为空、加载中、加载失败时都显示它(优先于 [fallbackColor])。
/// 自定义占位:地址为空、加载中、加载失败时都显示它(优先于 [fallbackColor])。
final Widget? fallbackWidget;
final int? decodeWidth;
final int? decodeHeight;
@@ -58,7 +54,7 @@ class RemoteImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final url = AppConfig.mediaUrl(path);
if (url.isEmpty) return _fallback(brand: showFallbackIcon);
if (url.isEmpty) return _fallback();
return LayoutBuilder(
builder: (context, constraints) {
final pixelRatio = MediaQuery.devicePixelRatioOf(context);
@@ -100,51 +96,23 @@ class RemoteImage extends StatelessWidget {
?.clamp(_minImageDecodePixels, _maxImageDecodePixels)
.toInt(),
gaplessPlayback: true,
errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon),
errorBuilder: (_, _, _) => _fallback(),
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded || frame != null) return child;
return _loadingFallback();
return _fallback();
},
);
},
);
}
Widget _loadingFallback() {
Widget _fallback() {
final custom = fallbackWidget;
if (custom != null) return custom;
return ImagePlaceholderShimmer(child: _fallback(brand: showFallbackIcon));
}
Widget _fallback({required bool brand}) {
final custom = fallbackWidget;
if (custom != null) return custom;
final mark = brand
? LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth.isFinite
? constraints.maxWidth
: 120.0;
return Center(
child: Image.asset(
'assets/icon/splash_logo.png',
key: fallbackIconKey,
width: width * 0.72,
fit: BoxFit.contain,
),
);
},
)
: null;
final fallback = Container(
width: width,
height: height,
color: brand ? AppColors.mediaBlack : fallbackColor,
alignment: Alignment.center,
child: mark,
);
final content = custom != null
? SizedBox(width: width, height: height, child: custom)
: Container(width: width, height: height, color: fallbackColor);
final ratio = fallbackAspectRatio;
if (ratio == null) return fallback;
return AspectRatio(aspectRatio: ratio, child: fallback);
if (ratio == null) return content;
return AspectRatio(aspectRatio: ratio, child: content);
}
}
+30 -2
View File
@@ -7,8 +7,8 @@ import '../theme/app_colors.dart';
const double _designSize = 30;
/// 根导航四个入口对应的图标种类。
enum RootNavGlyphKind { home, recommend, following, mine }
/// 根导航五个入口对应的图标种类。
enum RootNavGlyphKind { home, recommend, reward, following, mine }
/// 根导航插画图标,根据选中态使用品牌红和中性灰白配色。
class RootNavGlyph extends StatelessWidget {
@@ -52,6 +52,8 @@ class _RootNavGlyphPainter extends CustomPainter {
_paintHome(canvas);
case RootNavGlyphKind.recommend:
_paintRecommend(canvas);
case RootNavGlyphKind.reward:
_paintReward(canvas);
case RootNavGlyphKind.following:
_paintFollowing(canvas);
case RootNavGlyphKind.mine:
@@ -151,6 +153,32 @@ class _RootNavGlyphPainter extends CustomPainter {
canvas.drawPath(bookmark, Paint()..color = _light);
}
void _paintReward(Canvas canvas) {
final box = RRect.fromRectAndRadius(
const Rect.fromLTRB(4, 10, 26, 26),
const Radius.circular(4),
);
canvas.drawShadow(Path()..addRRect(box), AppColors.shadow, 2, false);
canvas.drawRRect(box, _gradient(const Rect.fromLTWH(4, 10, 22, 16)));
canvas.drawRect(const Rect.fromLTRB(3, 8, 27, 13), Paint()..color = _main);
canvas.drawRect(
const Rect.fromLTRB(13, 8, 17, 26),
Paint()..color = _light,
);
final left = Path()
..moveTo(15, 9)
..cubicTo(8, 9, 7, 3, 11, 3)
..cubicTo(14, 3, 15, 7, 15, 9)
..close();
final right = Path()
..moveTo(15, 9)
..cubicTo(22, 9, 23, 3, 19, 3)
..cubicTo(16, 3, 15, 7, 15, 9)
..close();
canvas.drawPath(left, Paint()..color = _light);
canvas.drawPath(right, Paint()..color = _light);
}
void _paintMine(Canvas canvas) {
final bounds = Rect.fromCircle(center: const Offset(15, 15), radius: 13);
canvas.drawShadow(Path()..addOval(bounds), AppColors.shadow, 2, false);
+49 -1
View File
@@ -32,6 +32,7 @@
"authContinueGoogle": "Continue with Google",
"authPhoneSignIn": "Phone sign in",
"authEmailSignIn": "Email sign in",
"authGoogleFailed": "Google sign in failed, please try again",
"suspense": "Suspense",
"romance": "Romance",
"actionGenre": "Action",
@@ -83,6 +84,12 @@
"count": {"type": "String"}
}
},
"likesLabel": "{count} likes",
"@likesLabel": {
"placeholders": {
"count": {"type": "String"}
}
},
"topCharts": "Hot Ranking",
"newReleases": "New Releases",
"newDramas": "New",
@@ -359,7 +366,7 @@
"categoriesError": "Categories could not be loaded.",
"detailError": "The episode list could not be loaded.",
"noMediaNotice": "This episode has no playable media yet.",
"noStories": "No stories available yet.",
"noStories": "No stories available yet",
"notices": "Notices",
"noNotices": "No notices yet.",
"noticesLoadFailed": "Notices could not be loaded.",
@@ -853,6 +860,47 @@
"aboutUs": "About us",
"aboutBrandName": "Your mini business",
"aboutDescription": "A focused, immersive place to watch short dramas.",
"rewardTab": "Rewards",
"rewardCenterTitle": "Reward Center",
"rewardTasksTab": "Tasks",
"rewardActivitiesTab": "Events",
"rewardMyCoins": "My coins",
"rewardCheckInTitle": "Check in for rewards",
"rewardCheckInSubtitle": "Check in daily to collect reward coins",
"rewardBoostCheckIn": "Boost check-in reward",
"rewardCheckInAction": "Check in",
"rewardCheckInActionWithCoins": "Check in +{coins} coins",
"@rewardCheckInActionWithCoins": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardCheckedIn": "Checked in",
"rewardToday": "Today",
"rewardDayLabel": "Day {day}",
"@rewardDayLabel": {
"placeholders": {"day": {"type": "int"}}
},
"rewardClaimAction": "Claim",
"rewardClaimed": "Claimed",
"rewardGoAction": "Go",
"rewardDailySectionSubtitle": "Complete daily tasks to collect reward coins",
"rewardNewbieSectionSubtitle": "Available once only",
"rewardInviteSectionSubtitle": "Invite friends and earn rewards together",
"rewardHelpTitle": "About rewards",
"rewardHelpBody": "Complete check-ins and tasks to earn reward coins. Rewards and task rules are shown on this page.",
"rewardComingSoon": "Coming soon",
"rewardEmptyTasks": "No reward tasks available",
"rewardEmptyActivities": "No events available",
"rewardRetry": "Retry",
"rewardCheckInSuccess": "+{coins} coins for checking in",
"@rewardCheckInSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardClaimSuccess": "+{coins} coins claimed",
"@rewardClaimSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardLoadFailed": "Couldn't load rewards",
"rewardActionFailed": "Action failed. Please try again.",
"versionLabel": "Version {version}",
"@versionLabel": {
"placeholders": {
+44 -1
View File
@@ -32,6 +32,7 @@
"authContinueGoogle": "Lanjutkan dengan Google",
"authPhoneSignIn": "Masuk dengan ponsel",
"authEmailSignIn": "Masuk dengan email",
"authGoogleFailed": "Gagal masuk dengan Google, silakan coba lagi",
"suspense": "Thriller",
"romance": "Romantis",
"actionGenre": "Aksi",
@@ -72,6 +73,7 @@
"authorNoteLabel": "Catatan penulis",
"reserve": "Reservasi",
"heatLabel": "{count} panas",
"likesLabel": "{count} suka",
"topCharts": "Peringkat Populer",
"newReleases": "Rilisan Baru",
"newDramas": "Baru",
@@ -338,7 +340,7 @@
"categoriesError": "Kategori gagal dimuat.",
"detailError": "Daftar episode gagal dimuat.",
"noMediaNotice": "Episode ini belum punya media yang bisa diputar.",
"noStories": "Belum ada cerita.",
"noStories": "Belum ada cerita",
"notices": "Notifikasi",
"noNotices": "Belum ada notifikasi.",
"noticesLoadFailed": "Notifikasi tidak dapat dimuat.",
@@ -815,6 +817,47 @@
"aboutUs": "Tentang kami",
"aboutBrandName": "Your mini business",
"aboutDescription": "Tempat fokus dan imersif untuk menonton drama pendek.",
"rewardTab": "Hadiah",
"rewardCenterTitle": "Pusat Hadiah",
"rewardTasksTab": "Tugas",
"rewardActivitiesTab": "Acara",
"rewardMyCoins": "Koin saya",
"rewardCheckInTitle": "Check-in untuk hadiah",
"rewardCheckInSubtitle": "Check-in setiap hari untuk mengumpulkan koin hadiah",
"rewardBoostCheckIn": "Tingkatkan hadiah check-in",
"rewardCheckInAction": "Check-in",
"rewardCheckInActionWithCoins": "Check-in +{coins} koin",
"@rewardCheckInActionWithCoins": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardCheckedIn": "Sudah check-in",
"rewardToday": "Hari ini",
"rewardDayLabel": "Hari {day}",
"@rewardDayLabel": {
"placeholders": {"day": {"type": "int"}}
},
"rewardClaimAction": "Ambil",
"rewardClaimed": "Sudah diambil",
"rewardGoAction": "Mulai",
"rewardDailySectionSubtitle": "Selesaikan tugas harian untuk mendapat koin hadiah",
"rewardNewbieSectionSubtitle": "Hanya tersedia satu kali",
"rewardInviteSectionSubtitle": "Undang teman dan dapatkan hadiah bersama",
"rewardHelpTitle": "Tentang hadiah",
"rewardHelpBody": "Selesaikan check-in dan tugas untuk mendapat koin hadiah. Hadiah dan aturan tugas mengikuti halaman ini.",
"rewardComingSoon": "Segera hadir",
"rewardEmptyTasks": "Belum ada tugas hadiah",
"rewardEmptyActivities": "Belum ada acara",
"rewardRetry": "Coba lagi",
"rewardCheckInSuccess": "+{coins} koin dari check-in",
"@rewardCheckInSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardClaimSuccess": "+{coins} koin berhasil diambil",
"@rewardClaimSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardLoadFailed": "Hadiah tidak dapat dimuat",
"rewardActionFailed": "Tindakan gagal. Silakan coba lagi.",
"versionLabel": "Versi {version}",
"@versionLabel": {
"placeholders": {
+187 -1
View File
@@ -292,6 +292,12 @@ abstract class AppLocalizations {
/// **'Email sign in'**
String get authEmailSignIn;
/// No description provided for @authGoogleFailed.
///
/// In en, this message translates to:
/// **'Google sign in failed, please try again'**
String get authGoogleFailed;
/// No description provided for @suspense.
///
/// In en, this message translates to:
@@ -442,6 +448,12 @@ abstract class AppLocalizations {
/// **'{count} heat'**
String heatLabel(String count);
/// No description provided for @likesLabel.
///
/// In en, this message translates to:
/// **'{count} likes'**
String likesLabel(String count);
/// No description provided for @topCharts.
///
/// In en, this message translates to:
@@ -1393,7 +1405,7 @@ abstract class AppLocalizations {
/// No description provided for @noStories.
///
/// In en, this message translates to:
/// **'No stories available yet.'**
/// **'No stories available yet'**
String get noStories;
/// No description provided for @notices.
@@ -3604,6 +3616,180 @@ abstract class AppLocalizations {
/// **'A focused, immersive place to watch short dramas.'**
String get aboutDescription;
/// No description provided for @rewardTab.
///
/// In en, this message translates to:
/// **'Rewards'**
String get rewardTab;
/// No description provided for @rewardCenterTitle.
///
/// In en, this message translates to:
/// **'Reward Center'**
String get rewardCenterTitle;
/// No description provided for @rewardTasksTab.
///
/// In en, this message translates to:
/// **'Tasks'**
String get rewardTasksTab;
/// No description provided for @rewardActivitiesTab.
///
/// In en, this message translates to:
/// **'Events'**
String get rewardActivitiesTab;
/// No description provided for @rewardMyCoins.
///
/// In en, this message translates to:
/// **'My coins'**
String get rewardMyCoins;
/// No description provided for @rewardCheckInTitle.
///
/// In en, this message translates to:
/// **'Check in for rewards'**
String get rewardCheckInTitle;
/// No description provided for @rewardCheckInSubtitle.
///
/// In en, this message translates to:
/// **'Check in daily to collect reward coins'**
String get rewardCheckInSubtitle;
/// No description provided for @rewardBoostCheckIn.
///
/// In en, this message translates to:
/// **'Boost check-in reward'**
String get rewardBoostCheckIn;
/// No description provided for @rewardCheckInAction.
///
/// In en, this message translates to:
/// **'Check in'**
String get rewardCheckInAction;
/// No description provided for @rewardCheckInActionWithCoins.
///
/// In en, this message translates to:
/// **'Check in +{coins} coins'**
String rewardCheckInActionWithCoins(int coins);
/// No description provided for @rewardCheckedIn.
///
/// In en, this message translates to:
/// **'Checked in'**
String get rewardCheckedIn;
/// No description provided for @rewardToday.
///
/// In en, this message translates to:
/// **'Today'**
String get rewardToday;
/// No description provided for @rewardDayLabel.
///
/// In en, this message translates to:
/// **'Day {day}'**
String rewardDayLabel(int day);
/// No description provided for @rewardClaimAction.
///
/// In en, this message translates to:
/// **'Claim'**
String get rewardClaimAction;
/// No description provided for @rewardClaimed.
///
/// In en, this message translates to:
/// **'Claimed'**
String get rewardClaimed;
/// No description provided for @rewardGoAction.
///
/// In en, this message translates to:
/// **'Go'**
String get rewardGoAction;
/// No description provided for @rewardDailySectionSubtitle.
///
/// In en, this message translates to:
/// **'Complete daily tasks to collect reward coins'**
String get rewardDailySectionSubtitle;
/// No description provided for @rewardNewbieSectionSubtitle.
///
/// In en, this message translates to:
/// **'Available once only'**
String get rewardNewbieSectionSubtitle;
/// No description provided for @rewardInviteSectionSubtitle.
///
/// In en, this message translates to:
/// **'Invite friends and earn rewards together'**
String get rewardInviteSectionSubtitle;
/// No description provided for @rewardHelpTitle.
///
/// In en, this message translates to:
/// **'About rewards'**
String get rewardHelpTitle;
/// No description provided for @rewardHelpBody.
///
/// In en, this message translates to:
/// **'Complete check-ins and tasks to earn reward coins. Rewards and task rules are shown on this page.'**
String get rewardHelpBody;
/// No description provided for @rewardComingSoon.
///
/// In en, this message translates to:
/// **'Coming soon'**
String get rewardComingSoon;
/// No description provided for @rewardEmptyTasks.
///
/// In en, this message translates to:
/// **'No reward tasks available'**
String get rewardEmptyTasks;
/// No description provided for @rewardEmptyActivities.
///
/// In en, this message translates to:
/// **'No events available'**
String get rewardEmptyActivities;
/// No description provided for @rewardRetry.
///
/// In en, this message translates to:
/// **'Retry'**
String get rewardRetry;
/// No description provided for @rewardCheckInSuccess.
///
/// In en, this message translates to:
/// **'+{coins} coins for checking in'**
String rewardCheckInSuccess(int coins);
/// No description provided for @rewardClaimSuccess.
///
/// In en, this message translates to:
/// **'+{coins} coins claimed'**
String rewardClaimSuccess(int coins);
/// No description provided for @rewardLoadFailed.
///
/// In en, this message translates to:
/// **'Couldn\'t load rewards'**
String get rewardLoadFailed;
/// No description provided for @rewardActionFailed.
///
/// In en, this message translates to:
/// **'Action failed. Please try again.'**
String get rewardActionFailed;
/// No description provided for @versionLabel.
///
/// In en, this message translates to:
+107 -1
View File
@@ -106,6 +106,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get authEmailSignIn => 'Email sign in';
@override
String get authGoogleFailed => 'Google sign in failed, please try again';
@override
String get suspense => 'Suspense';
@@ -191,6 +194,11 @@ class AppLocalizationsEn extends AppLocalizations {
return '$count heat';
}
@override
String likesLabel(String count) {
return '$count likes';
}
@override
String get topCharts => 'Hot Ranking';
@@ -709,7 +717,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get noMediaNotice => 'This episode has no playable media yet.';
@override
String get noStories => 'No stories available yet.';
String get noStories => 'No stories available yet';
@override
String get notices => 'Notices';
@@ -1893,6 +1901,104 @@ class AppLocalizationsEn extends AppLocalizations {
String get aboutDescription =>
'A focused, immersive place to watch short dramas.';
@override
String get rewardTab => 'Rewards';
@override
String get rewardCenterTitle => 'Reward Center';
@override
String get rewardTasksTab => 'Tasks';
@override
String get rewardActivitiesTab => 'Events';
@override
String get rewardMyCoins => 'My coins';
@override
String get rewardCheckInTitle => 'Check in for rewards';
@override
String get rewardCheckInSubtitle => 'Check in daily to collect reward coins';
@override
String get rewardBoostCheckIn => 'Boost check-in reward';
@override
String get rewardCheckInAction => 'Check in';
@override
String rewardCheckInActionWithCoins(int coins) {
return 'Check in +$coins coins';
}
@override
String get rewardCheckedIn => 'Checked in';
@override
String get rewardToday => 'Today';
@override
String rewardDayLabel(int day) {
return 'Day $day';
}
@override
String get rewardClaimAction => 'Claim';
@override
String get rewardClaimed => 'Claimed';
@override
String get rewardGoAction => 'Go';
@override
String get rewardDailySectionSubtitle =>
'Complete daily tasks to collect reward coins';
@override
String get rewardNewbieSectionSubtitle => 'Available once only';
@override
String get rewardInviteSectionSubtitle =>
'Invite friends and earn rewards together';
@override
String get rewardHelpTitle => 'About rewards';
@override
String get rewardHelpBody =>
'Complete check-ins and tasks to earn reward coins. Rewards and task rules are shown on this page.';
@override
String get rewardComingSoon => 'Coming soon';
@override
String get rewardEmptyTasks => 'No reward tasks available';
@override
String get rewardEmptyActivities => 'No events available';
@override
String get rewardRetry => 'Retry';
@override
String rewardCheckInSuccess(int coins) {
return '+$coins coins for checking in';
}
@override
String rewardClaimSuccess(int coins) {
return '+$coins coins claimed';
}
@override
String get rewardLoadFailed => 'Couldn\'t load rewards';
@override
String get rewardActionFailed => 'Action failed. Please try again.';
@override
String versionLabel(String version) {
return 'Version $version';
+108 -1
View File
@@ -106,6 +106,9 @@ class AppLocalizationsId extends AppLocalizations {
@override
String get authEmailSignIn => 'Masuk dengan email';
@override
String get authGoogleFailed => 'Gagal masuk dengan Google, silakan coba lagi';
@override
String get suspense => 'Thriller';
@@ -191,6 +194,11 @@ class AppLocalizationsId extends AppLocalizations {
return '$count panas';
}
@override
String likesLabel(String count) {
return '$count suka';
}
@override
String get topCharts => 'Peringkat Populer';
@@ -712,7 +720,7 @@ class AppLocalizationsId extends AppLocalizations {
'Episode ini belum punya media yang bisa diputar.';
@override
String get noStories => 'Belum ada cerita.';
String get noStories => 'Belum ada cerita';
@override
String get notices => 'Notifikasi';
@@ -1895,6 +1903,105 @@ class AppLocalizationsId extends AppLocalizations {
String get aboutDescription =>
'Tempat fokus dan imersif untuk menonton drama pendek.';
@override
String get rewardTab => 'Hadiah';
@override
String get rewardCenterTitle => 'Pusat Hadiah';
@override
String get rewardTasksTab => 'Tugas';
@override
String get rewardActivitiesTab => 'Acara';
@override
String get rewardMyCoins => 'Koin saya';
@override
String get rewardCheckInTitle => 'Check-in untuk hadiah';
@override
String get rewardCheckInSubtitle =>
'Check-in setiap hari untuk mengumpulkan koin hadiah';
@override
String get rewardBoostCheckIn => 'Tingkatkan hadiah check-in';
@override
String get rewardCheckInAction => 'Check-in';
@override
String rewardCheckInActionWithCoins(int coins) {
return 'Check-in +$coins koin';
}
@override
String get rewardCheckedIn => 'Sudah check-in';
@override
String get rewardToday => 'Hari ini';
@override
String rewardDayLabel(int day) {
return 'Hari $day';
}
@override
String get rewardClaimAction => 'Ambil';
@override
String get rewardClaimed => 'Sudah diambil';
@override
String get rewardGoAction => 'Mulai';
@override
String get rewardDailySectionSubtitle =>
'Selesaikan tugas harian untuk mendapat koin hadiah';
@override
String get rewardNewbieSectionSubtitle => 'Hanya tersedia satu kali';
@override
String get rewardInviteSectionSubtitle =>
'Undang teman dan dapatkan hadiah bersama';
@override
String get rewardHelpTitle => 'Tentang hadiah';
@override
String get rewardHelpBody =>
'Selesaikan check-in dan tugas untuk mendapat koin hadiah. Hadiah dan aturan tugas mengikuti halaman ini.';
@override
String get rewardComingSoon => 'Segera hadir';
@override
String get rewardEmptyTasks => 'Belum ada tugas hadiah';
@override
String get rewardEmptyActivities => 'Belum ada acara';
@override
String get rewardRetry => 'Coba lagi';
@override
String rewardCheckInSuccess(int coins) {
return '+$coins koin dari check-in';
}
@override
String rewardClaimSuccess(int coins) {
return '+$coins koin berhasil diambil';
}
@override
String get rewardLoadFailed => 'Hadiah tidak dapat dimuat';
@override
String get rewardActionFailed => 'Tindakan gagal. Silakan coba lagi.';
@override
String versionLabel(String version) {
return 'Versi $version';
+104 -1
View File
@@ -104,6 +104,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get authEmailSignIn => '邮箱登录';
@override
String get authGoogleFailed => 'Google 登录失败,请稍后重试';
@override
String get suspense => '悬疑';
@@ -189,6 +192,11 @@ class AppLocalizationsZh extends AppLocalizations {
return '$count热度';
}
@override
String likesLabel(String count) {
return '$count次点赞';
}
@override
String get topCharts => '热播榜';
@@ -702,7 +710,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get noMediaNotice => '该剧集还没有可播放的片源。';
@override
String get noStories => '暂无剧目。';
String get noStories => '暂无剧目';
@override
String get notices => '通知';
@@ -1867,6 +1875,101 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get aboutDescription => '专注于短剧观看与沉浸式追剧体验。';
@override
String get rewardTab => '奖励';
@override
String get rewardCenterTitle => '奖励中心';
@override
String get rewardTasksTab => '任务';
@override
String get rewardActivitiesTab => '活动';
@override
String get rewardMyCoins => '我的金币';
@override
String get rewardCheckInTitle => '签到领奖励';
@override
String get rewardCheckInSubtitle => '每日签到,领取奖励币';
@override
String get rewardBoostCheckIn => '提升签到奖励';
@override
String get rewardCheckInAction => '立即签到';
@override
String rewardCheckInActionWithCoins(int coins) {
return '签到 +$coins 奖励币';
}
@override
String get rewardCheckedIn => '今日已签到';
@override
String get rewardToday => '今天';
@override
String rewardDayLabel(int day) {
return '第 $day 天';
}
@override
String get rewardClaimAction => '领取';
@override
String get rewardClaimed => '已领取';
@override
String get rewardGoAction => '去完成';
@override
String get rewardDailySectionSubtitle => '每日完成任务,领取奖励币';
@override
String get rewardNewbieSectionSubtitle => '仅有一次机会';
@override
String get rewardInviteSectionSubtitle => '邀请好友一起获得奖励';
@override
String get rewardHelpTitle => '奖励中心说明';
@override
String get rewardHelpBody => '完成签到和任务可获得奖励币,具体奖励与任务规则以页面展示为准。';
@override
String get rewardComingSoon => '功能即将开放';
@override
String get rewardEmptyTasks => '暂无奖励任务';
@override
String get rewardEmptyActivities => '暂无活动';
@override
String get rewardRetry => '重新加载';
@override
String rewardCheckInSuccess(int coins) {
return '签到成功,获得 $coins 金币';
}
@override
String rewardClaimSuccess(int coins) {
return '领取成功,获得 $coins 金币';
}
@override
String get rewardLoadFailed => '奖励数据加载失败';
@override
String get rewardActionFailed => '操作失败,请稍后重试';
@override
String versionLabel(String version) {
return '版本 $version';
+44 -1
View File
@@ -32,6 +32,7 @@
"authContinueGoogle": "使用 Google 继续",
"authPhoneSignIn": "手机号登录",
"authEmailSignIn": "邮箱登录",
"authGoogleFailed": "Google 登录失败,请稍后重试",
"suspense": "悬疑",
"romance": "都市爱情",
"actionGenre": "动作",
@@ -72,6 +73,7 @@
"authorNoteLabel": "作者声明",
"reserve": "预约",
"heatLabel": "{count}热度",
"likesLabel": "{count}次点赞",
"topCharts": "热播榜",
"newReleases": "新剧",
"newDramas": "新剧",
@@ -300,7 +302,7 @@
"categoriesError": "分类加载失败。",
"detailError": "剧集信息加载失败。",
"noMediaNotice": "该剧集还没有可播放的片源。",
"noStories": "暂无剧目。",
"noStories": "暂无剧目",
"notices": "通知",
"noNotices": "暂无通知。",
"noticesLoadFailed": "通知加载失败,请重试。",
@@ -777,6 +779,47 @@
"aboutUs": "关于我们",
"aboutBrandName": "Your mini business",
"aboutDescription": "专注于短剧观看与沉浸式追剧体验。",
"rewardTab": "奖励",
"rewardCenterTitle": "奖励中心",
"rewardTasksTab": "任务",
"rewardActivitiesTab": "活动",
"rewardMyCoins": "我的金币",
"rewardCheckInTitle": "签到领奖励",
"rewardCheckInSubtitle": "每日签到,领取奖励币",
"rewardBoostCheckIn": "提升签到奖励",
"rewardCheckInAction": "立即签到",
"rewardCheckInActionWithCoins": "签到 +{coins} 奖励币",
"@rewardCheckInActionWithCoins": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardCheckedIn": "今日已签到",
"rewardToday": "今天",
"rewardDayLabel": "第 {day} 天",
"@rewardDayLabel": {
"placeholders": {"day": {"type": "int"}}
},
"rewardClaimAction": "领取",
"rewardClaimed": "已领取",
"rewardGoAction": "去完成",
"rewardDailySectionSubtitle": "每日完成任务,领取奖励币",
"rewardNewbieSectionSubtitle": "仅有一次机会",
"rewardInviteSectionSubtitle": "邀请好友一起获得奖励",
"rewardHelpTitle": "奖励中心说明",
"rewardHelpBody": "完成签到和任务可获得奖励币,具体奖励与任务规则以页面展示为准。",
"rewardComingSoon": "功能即将开放",
"rewardEmptyTasks": "暂无奖励任务",
"rewardEmptyActivities": "暂无活动",
"rewardRetry": "重新加载",
"rewardCheckInSuccess": "签到成功,获得 {coins} 金币",
"@rewardCheckInSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardClaimSuccess": "领取成功,获得 {coins} 金币",
"@rewardClaimSuccess": {
"placeholders": {"coins": {"type": "int"}}
},
"rewardLoadFailed": "奖励数据加载失败",
"rewardActionFailed": "操作失败,请稍后重试",
"versionLabel": "版本 {version}",
"@versionLabel": {
"placeholders": {
+91 -24
View File
@@ -9,6 +9,7 @@ import '../../core/data/remote/api_client.dart';
import '../../core/formatting/error_text.dart';
import '../../core/data/services/app_config_controller.dart';
import '../../core/data/services/auth_controller.dart';
import '../../core/data/services/google_auth_service.dart';
import '../../core/platform/haptics.dart';
import '../../core/platform/keyboard_inset.dart';
import '../../core/theme/app_colors.dart';
@@ -20,7 +21,6 @@ import '../../core/widgets/subpage_header.dart';
import '../../l10n/app_localizations.dart';
import 'auth_legal_links.dart';
import 'auth_logic.dart';
import 'phone_auth_sheet.dart';
part 'auth_widgets.dart';
part 'auth_form_widgets.dart';
@@ -31,6 +31,7 @@ const double _compactBrandMarkSize = 48;
const double _brandMarkRadius = 26;
const double _compactBrandMarkRadius = 14;
const String _appLogoAsset = 'assets/icon/ymb.png';
const String _googleIconAsset = 'assets/icon/google_g.png';
const double _contentMaxWidth = 440;
const double _fieldHeight = 52;
const double _fieldRadius = 12;
@@ -49,6 +50,8 @@ const double _entryButtonHeight = 52;
const double _entryButtonRadius = 26;
const double _entryButtonFontSize = 15;
const double _entryIconSize = 20;
const double _loadingStrokeWidth = 2;
const Color _googleOnLight = Color(0xFF1F1F1F);
const Duration _enterDuration = Duration(milliseconds: 220);
Widget _brandMarkWidget({
@@ -80,6 +83,7 @@ class AuthPage extends StatefulWidget {
class _AuthPageState extends State<AuthPage> {
late AuthLogic _logic;
late final GoogleAuthService _googleAuth;
late final TextEditingController _emailController;
late final TextEditingController _passwordController;
late final FocusNode _emailFocus;
@@ -94,6 +98,7 @@ class _AuthPageState extends State<AuthPage> {
void initState() {
super.initState();
_logic = AuthLogic(signUpMode: widget.signUpMode);
_googleAuth = GoogleAuthService();
_emailController = TextEditingController();
_passwordController = TextEditingController();
_emailFocus = FocusNode(debugLabel: 'auth-email-focus');
@@ -248,6 +253,42 @@ class _AuthPageState extends State<AuthPage> {
showCenteredToast(context, failureMessage);
}
/// Google 登录:先取 Google idToken,再交给后端换发本应用令牌。
///
/// 用户取消不提示错误;平台不支持或授权失败提示重试。
Future<void> _signInWithGoogle() async {
if (_logic.busy) return;
final l10n = AppLocalizations.of(context)!;
unawaited(context.read<Haptics>().lightImpact());
FocusScope.of(context).unfocus();
setState(() {
_logic.busy = true;
_logic.errorMessage = null;
});
final auth = context.read<AuthController>();
String? failureMessage;
try {
final outcome = await _googleAuth.signIn();
if (!mounted) return;
if (outcome.canceled) return;
if (!outcome.isSuccess) {
failureMessage = l10n.authGoogleFailed;
} else {
await auth.signInWithGoogle(outcome.idToken!);
if (!mounted) return;
Navigator.of(context).maybePop();
}
} on ApiException catch (error) {
failureMessage = userFacingApiMessage(l10n, error.code, error.message);
} catch (_) {
failureMessage = l10n.authNetworkError;
} finally {
if (mounted) setState(() => _logic.busy = false);
}
if (!mounted || failureMessage == null) return;
showCenteredToast(context, failureMessage);
}
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
@@ -437,21 +478,23 @@ class _AuthPageState extends State<AuthPage> {
),
),
const Spacer(flex: 2),
_AuthEntryButton(
key: const Key('auth-entry-phone'),
label: l10n.authPhoneSignIn,
icon: Icons.phone_android_rounded,
primary: true,
onTap: _openPhoneSheet,
),
const SizedBox(height: 12),
_AuthEntryButton(
key: const Key('auth-entry-email'),
label: l10n.authEmailSignIn,
icon: Icons.mail_outline_rounded,
primary: false,
primary: true,
onTap: () => setState(() => _emailEntryOpen = true),
),
const SizedBox(height: 12),
_AuthEntryButton(
key: const Key('auth-entry-google'),
label: l10n.authContinueGoogle,
imageAsset: _googleIconAsset,
light: true,
primary: false,
loading: _logic.busy,
onTap: _signInWithGoogle,
),
const SizedBox(height: 14),
const Opacity(opacity: 0.75, child: AuthLegalLinks()),
const Spacer(flex: 6),
@@ -459,14 +502,6 @@ class _AuthPageState extends State<AuthPage> {
),
);
Future<void> _openPhoneSheet() async {
final signedIn = await showPhoneAuthSheet(
context,
signUp: _logic.signUpMode,
);
if (signedIn == true && mounted) Navigator.of(context).maybePop();
}
Widget _authCard(AppLocalizations l10n) => _AuthCard(
state: _AuthCardState(
l10n: l10n,
@@ -513,6 +548,9 @@ class _AuthEntryButton extends StatelessWidget {
required this.primary,
required this.onTap,
this.icon,
this.imageAsset,
this.light = false,
this.loading = false,
});
final String label;
@@ -520,13 +558,24 @@ class _AuthEntryButton extends StatelessWidget {
final VoidCallback onTap;
final IconData? icon;
/// 需要显示彩色品牌图标时用图片;与 [icon] 二选一。
final String? imageAsset;
/// 白底深字样式(Google 官方按钮规范),用于第三方登录入口。
final bool light;
/// 请求进行中:显示转圈并禁止重复点击。
final bool loading;
@override
Widget build(BuildContext context) {
// 主按钮纯品牌红;次按钮为无边框深色玻璃(白 6%),Apple 风格。
// 主按钮纯品牌红;次按钮为无边框深色玻璃(白 6%);第三方登录用白底深字。
final background = primary
? AppColors.brandRed
: Colors.white.withValues(alpha: 0.06);
final foreground = primary ? AppColors.onPrimary : AppColors.onSurface;
: (light ? Colors.white : Colors.white.withValues(alpha: 0.06));
final foreground = primary
? AppColors.onPrimary
: (light ? _googleOnLight : AppColors.onSurface);
return Material(
color: background,
shape: RoundedRectangleBorder(
@@ -534,16 +583,34 @@ class _AuthEntryButton extends StatelessWidget {
),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
onTap: loading ? null : onTap,
borderRadius: BorderRadius.circular(_entryButtonRadius),
child: SizedBox(
height: _entryButtonHeight,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (icon != null)
if (loading) ...[
SizedBox(
width: _entryIconSize,
height: _entryIconSize,
child: CircularProgressIndicator(
strokeWidth: _loadingStrokeWidth,
valueColor: AlwaysStoppedAnimation<Color>(foreground),
),
),
const SizedBox(width: 10),
] else if (imageAsset != null) ...[
Image.asset(
imageAsset!,
width: _entryIconSize,
height: _entryIconSize,
),
const SizedBox(width: 10),
] else if (icon != null) ...[
Icon(icon, size: _entryIconSize, color: foreground),
if (icon != null) const SizedBox(width: 8),
const SizedBox(width: 8),
],
Flexible(
child: Text(
label,
+1 -1
View File
@@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import '../../core/data/models/drama.dart';
/// 推荐页与根导航之间的动作。
enum DiscoverPageAction { home, recommend, following, mine }
enum DiscoverPageAction { home, recommend, reward, following, mine }
/// 剧场页导航回调;没有 `onAction` 时按独立页面处理。
class DiscoverPageCallbacks {
+2
View File
@@ -297,6 +297,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
icon: Icons.movie_filter_outlined,
title: l10n.noStories,
subtitle: l10n.emptyHint,
stretchContent: true,
),
),
)
@@ -471,6 +472,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
DiscoverPageAction _actionOf(AppRootTab tab) => switch (tab) {
AppRootTab.home => DiscoverPageAction.home,
AppRootTab.recommend => DiscoverPageAction.recommend,
AppRootTab.reward => DiscoverPageAction.reward,
AppRootTab.following => DiscoverPageAction.following,
AppRootTab.mine => DiscoverPageAction.mine,
};
Loaded 100 of 180 files, more files were not shown because too many files have changed in this diff. Show more