24 Commits
Author SHA1 Message Date
Zhou Weidong 66c03ee245 chore(release): 发布 iOS 分享面板修复
flutter-ci / test (push) Canceled after 0s
# Conflicts:
#	lib/core/config/app_config.dart
2026-10-31 14:02:40 +08:00
Zhou Weidong a3ac007759 fix(config): release 构建自动使用生产环境 2026-10-31 14:00:33 +08:00
Zhou Weidong 8ec6df2be5 merge: 修复 iOS 系统分享面板
flutter-ci / test (push) Canceled after 0s
2026-10-31 13:40:14 +08:00
Zhou Weidong 5ec4db151a fix(ios): 修复分享面板并同步互动栏布局断言 2026-10-31 13:33:13 +08:00
Vicky 525f58c150 chore(release): 合并 develop 到 main
flutter-ci / test (push) Canceled after 0s
2026-10-31 09:49:54 +08:00
Vicky a47af8c3ad style(player): 视频信息区文案统一为 65% 半透明白
flutter-ci / test (push) Canceled after 0s
2026-10-31 09:41:19 +08:00
Vicky 0a02620564 chore(release): 合并 develop 到 main
flutter-ci / test (push) Canceled after 0s
2026-10-31 00:02:59 +08:00
Vicky 2ddf9ee1c6 test(config): 服务地址断言跟随环境开关
flutter-ci / test (push) Canceled after 0s
2026-10-31 00:02:53 +08:00
Vicky 3bc79ad8e2 fix(i18n): 去掉印尼语内容完整性过滤,缺失时回退中文 2026-10-31 00:02:53 +08:00
Vicky 78a33cd4f1 chore(release): 合并 develop 到 main
flutter-ci / test (push) Canceled after 0s
2026-10-30 22:56:52 +08:00
Vicky c307903c42 docs: 修正 README 中的分析基线文案
flutter-ci / test (push) Canceled after 0s
2026-10-30 22:53:18 +08:00
Vicky c5b94633f1 feat(following): 收藏页改为紧凑布局并去掉重复续播横幅 2026-10-30 22:53:18 +08:00
Vicky fd2ba0bf43 feat(player): 重做播放页信息层级与互动栏点击动效 2026-10-30 22:53:18 +08:00
Vicky aed9ee2b01 feat(image): 图片加载占位改为微光骨架 2026-10-30 22:53:18 +08:00
Vicky 335e5dc286 feat(home): 顶部导航随翻页联动并把推荐更名为精选 2026-10-30 22:53:15 +08:00
Vicky e8610b7aed chore(release): 生产包切换为生产环境地址
flutter-ci / test (push) Canceled after 0s
2026-10-30 17:20:48 +08:00
Vicky 2f4593a46e fix(a11y): 限制底栏文字缩放并统一播放页触控尺寸
flutter-ci / test (push) Canceled after 0s
2026-10-30 17:14:40 +08:00
Vicky 7509cf2ecd fix(following): 减淡继续观看封面遮罩亮度 2026-10-30 17:14:40 +08:00
Vicky 501bc66282 fix(wallet): 丢弃切换账号后返回的旧余额响应 2026-10-30 17:14:40 +08:00
Vicky 19196ceb8e fix(i18n): 印尼语内容缺失时不再回退中文 2026-10-30 17:14:37 +08:00
Vicky 9ef8eb15b0 feat(recommend): 轮播只保留标题简介并重做顶部导航 2026-10-30 17:14:34 +08:00
Vicky 53e8c924a6 feat(mine): 重做我的页会员卡与功能宫格布局 2026-10-30 17:14:32 +08:00
Vicky e7399fa3fd feat(auth): 登录页改为 ymb 品牌并支持后台配置背景图 2026-10-30 17:14:30 +08:00
Vicky 22cc669bbe feat(brand): 应用图标、开屏资源与品牌字体切换为 ymb 2026-10-30 17:14:27 +08:00
166 changed files with 6953 additions and 1973 deletions

No files matched your search

+8 -5
View File
@@ -81,12 +81,15 @@ Android 模拟器访问宿主机时,同样在调试条里填 `http://10.0.2.2:
### iOS ### iOS
手机与 Mac 需在同一网络,首次启动允许“本地网络”权限: iOS 模拟器直接访问 Mac 本机服务,默认地址为 `http://127.0.0.1:8081`:
```bash ```bash
flutter run -d <udid> flutter run -d <simulator-udid>
``` ```
iPhone 真机不能用 `127.0.0.1` 访问 Mac;真机联调时需让手机与 Mac 位于同一网络,
并通过调试入口临时填写 Mac 的局域网地址。
### 服务地址配置 ### 服务地址配置
地址是代码里的一个开关,**不做任何网络探测**,也不用传构建参数。两套环境各占 地址是代码里的一个开关,**不做任何网络探测**,也不用传构建参数。两套环境各占
@@ -94,7 +97,7 @@ flutter run -d <udid>
| 文件 | 用途 | 默认值 | | 文件 | 用途 | 默认值 |
| --- | --- | --- | | --- | --- | --- |
| `lib/core/config/dev_config.dart` | 开发 / 联调 | `http://192.168.31.243:8081` | | `lib/core/config/dev_config.dart` | 开发 / 联调 | `http://127.0.0.1:8081` |
| `lib/core/config/prod_config.dart` | 生产 | `http://39.162.50.99:8081` | | `lib/core/config/prod_config.dart` | 生产 | `http://39.162.50.99:8081` |
切换环境只改 `lib/core/config/app_config.dart` 里的一个布尔值: 切换环境只改 `lib/core/config/app_config.dart` 里的一个布尔值:
@@ -103,7 +106,7 @@ flutter run -d <udid>
static const bool useDevConfig = true; // false 即用生产地址 static const bool useDevConfig = true; // false 即用生产地址
``` ```
换 Wi-Fi 或换网段时只改 `dev_config.dart` 的 `baseUrl`。打生产包前把 真机或 Android 模拟器联调时,通过调试入口覆盖地址,不修改默认开发配置。打生产包前把
`useDevConfig` 改成 `false`;release 构建若仍为 `true` 会在启动时直接报错, `useDevConfig` 改成 `false`;release 构建若仍为 `true` 会在启动时直接报错,
避免线上包连到开发机。 避免线上包连到开发机。
@@ -197,7 +200,7 @@ flutter test
flutter build apk --debug flutter build apk --debug
``` ```
当前基线:`dart analyze` 仅 1 条既存 info(`intl` 未在 `pubspec.yaml` 声明); 当前基线:`dart analyze` 仅 1 条既存 info(`intl` 未在 `pubspec.yaml` 声明);
`flutter test` 全量 775 例通过。测试文件按模块放在 `test/` 下,用例名使用 `flutter test` 全量 775 例通过。测试文件按模块放在 `test/` 下,用例名使用
`should_<期望>_when_<条件>`。真实后端联调测试在服务未启动时会跳过。 `should_<期望>_when_<条件>`。真实后端联调测试在服务未启动时会跳过。
+1 -1
View File
@@ -6,7 +6,7 @@
<uses-permission <uses-permission
android:name="android.permission.SYSTEM_ALERT_WINDOW"/> android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application <application
android:label="FruitShorts" android:label="ymb"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="true">
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

@@ -2,6 +2,18 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" /> <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> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
@@ -2,6 +2,18 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" /> <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> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

@@ -2,6 +2,18 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" /> <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> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
@@ -2,6 +2,18 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" /> <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> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

@@ -2,6 +2,18 @@
<!-- Author: fruit.com.cn --> <!-- Author: fruit.com.cn -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_background" /> <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> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -8,7 +8,7 @@
<item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#000000</item> <item name="android:windowSplashScreenBackground">#000000</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_brand</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
<item name="android:windowSplashScreenAnimationDuration">0</item> <item name="android:windowSplashScreenAnimationDuration">0</item>
</style> </style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
@@ -8,7 +8,7 @@
<item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#000000</item> <item name="android:windowSplashScreenBackground">#000000</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_brand</item> <item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
<item name="android:windowSplashScreenAnimationDuration">0</item> <item name="android:windowSplashScreenAnimationDuration">0</item>
</style> </style>
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
+1 -1
View File
@@ -3,5 +3,5 @@
<resources> <resources>
<color name="splash_background">#000000</color> <color name="splash_background">#000000</color>
<color name="ic_launcher_background">#FF6B2C</color> <color name="ic_launcher_background">#E9142E</color>
</resources> </resources>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

+48 -6
View File
@@ -386,15 +386,29 @@ final class PipShadowCoordinator: NSObject, AVPictureInPictureControllerDelegate
guard call.method == "shareText", guard call.method == "shareText",
let arguments = call.arguments as? [String: Any], let arguments = call.arguments as? [String: Any],
let text = arguments["text"] as? String, let text = arguments["text"] as? String,
!text.isEmpty, !text.isEmpty else {
let controller = self?.window?.rootViewController else {
result(FlutterError(code: "share_unavailable", message: "Share sheet is unavailable", details: nil)) result(FlutterError(code: "share_unavailable", message: "Share sheet is unavailable", details: nil))
return return
} }
let activity = UIActivityViewController(activityItems: [text], applicationActivities: nil) DispatchQueue.main.async {
activity.popoverPresentationController?.sourceView = controller.view guard let controller = self?.sharePresenter() else {
activity.completionWithItemsHandler = { _, _, _, _ in result(nil) } result(FlutterError(code: "share_unavailable", message: "Share sheet is unavailable", details: nil))
controller.present(activity, animated: true) return
}
let activity = UIActivityViewController(activityItems: [text], applicationActivities: nil)
if let popover = activity.popoverPresentationController {
popover.sourceView = controller.view
popover.sourceRect = CGRect(
x: controller.view.bounds.midX,
y: controller.view.bounds.midY,
width: 0,
height: 0
)
popover.permittedArrowDirections = []
}
activity.completionWithItemsHandler = { _, _, _, _ in result(nil) }
controller.present(activity, animated: true)
}
} }
let thumbnailChannel = FlutterMethodChannel( let thumbnailChannel = FlutterMethodChannel(
@@ -459,6 +473,34 @@ final class PipShadowCoordinator: NSObject, AVPictureInPictureControllerDelegate
} }
} }
/// 当前前台 Scene 的根控制器之上,最适合展示系统分享面板的控制器。
private func sharePresenter() -> UIViewController? {
let keyWindow = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.first { $0.activationState == .foregroundActive }?
.windows.first { $0.isKeyWindow }
guard let rootController = keyWindow?.rootViewController else { return nil }
let presenter = topPresentedController(from: rootController)
guard presenter.viewIfLoaded?.window != nil else { return nil }
return presenter
}
/// 解析已展示页面、导航栈和标签页中的当前可见控制器。
private func topPresentedController(from controller: UIViewController) -> UIViewController {
if let presented = controller.presentedViewController {
return topPresentedController(from: presented)
}
if let navigation = controller as? UINavigationController,
let visible = navigation.visibleViewController {
return topPresentedController(from: visible)
}
if let tabs = controller as? UITabBarController,
let selected = tabs.selectedViewController {
return topPresentedController(from: selected)
}
return controller
}
/// iOS 画中画:影子播放器通道,与 Android 共用同一 channel 名。 /// iOS 画中画:影子播放器通道,与 Android 共用同一 channel 名。
private func registerPipChannel(_ engineBridge: FlutterImplicitEngineBridge) { private func registerPipChannel(_ engineBridge: FlutterImplicitEngineBridge) {
let channel = FlutterMethodChannel( let channel = FlutterMethodChannel(
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 734 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 655 KiB

+103 -103
View File
@@ -1,115 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>ymb</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ymb</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict> <dict>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>NSAllowsLocalNetworking</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>FruitShorts</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FruitShorts</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSExceptionDomains</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>127.0.0.1</key>
<true/>
<key>NSAllowsLocalNetworking</key>
<true/>
<key>NSExceptionDomains</key>
<dict> <dict>
<key>127.0.0.1</key> <key>NSExceptionAllowsInsecureHTTPLoads</key>
<dict> <true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <key>NSIncludesSubdomains</key>
<true/> <true/>
<key>NSIncludesSubdomains</key> </dict>
<true/> <key>192.168.31.243</key>
</dict> <dict>
<key>localhost</key> <key>NSExceptionAllowsInsecureHTTPLoads</key>
<dict> <true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <key>NSIncludesSubdomains</key>
<true/> <true/>
<key>NSIncludesSubdomains</key> </dict>
<true/> <key>39.162.50.99</key>
</dict> <dict>
<key>192.168.31.243</key> <key>NSExceptionAllowsInsecureHTTPLoads</key>
<dict> <true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <key>NSIncludesSubdomains</key>
<true/> <true/>
<key>NSIncludesSubdomains</key> </dict>
<true/> <key>localhost</key>
</dict> <dict>
<key>39.162.50.99</key> <key>NSExceptionAllowsInsecureHTTPLoads</key>
<dict> <true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <key>NSIncludesSubdomains</key>
<true/> <true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict> </dict>
</dict> </dict>
<key>NSLocalNetworkUsageDescription</key>
<string>开发阶段需要访问同一局域网内的短剧内容服务。</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarHidden</key>
<false/>
</dict> </dict>
<key>NSLocalNetworkUsageDescription</key>
<string>开发阶段需要访问同一局域网内的短剧内容服务。</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist> </plist>
+10
View File
@@ -14,6 +14,7 @@ import 'core/data/remote/catalog_api.dart';
import 'core/data/remote/category_api.dart'; import 'core/data/remote/category_api.dart';
import 'core/data/remote/comment_api.dart'; import 'core/data/remote/comment_api.dart';
import 'core/data/remote/commerce_api.dart'; import 'core/data/remote/commerce_api.dart';
import 'core/data/remote/config_api.dart';
import 'core/data/remote/device_profile.dart'; import 'core/data/remote/device_profile.dart';
import 'core/data/remote/download_api.dart'; import 'core/data/remote/download_api.dart';
import 'core/data/remote/interaction_api.dart'; import 'core/data/remote/interaction_api.dart';
@@ -35,6 +36,7 @@ import 'core/data/repositories/playlist_repository.dart';
import 'core/data/repositories/search_repository.dart'; import 'core/data/repositories/search_repository.dart';
import 'core/data/repositories/store_repository.dart'; import 'core/data/repositories/store_repository.dart';
import 'core/data/repositories/watch_history_repository.dart'; import 'core/data/repositories/watch_history_repository.dart';
import 'core/data/services/app_config_controller.dart';
import 'core/data/services/auth_controller.dart'; import 'core/data/services/auth_controller.dart';
import 'core/data/services/auth_session_store.dart'; import 'core/data/services/auth_session_store.dart';
import 'core/data/services/catalog_controller.dart'; import 'core/data/services/catalog_controller.dart';
@@ -208,6 +210,11 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
late final LocaleController _localeController = LocaleController(); late final LocaleController _localeController = LocaleController();
/// 后台下发的启动配置(登录页背景等);拉不到就用本地默认。
late final AppConfigController _appConfigController = AppConfigController(
ConfigApi(_apiClient),
);
/// 登录期内共享的「已解锁收费集」:播放页进出、feed 与全屏切换都要沿用。 /// 登录期内共享的「已解锁收费集」:播放页进出、feed 与全屏切换都要沿用。
late final UnlockedEpisodeRegistry _unlockedEpisodes = late final UnlockedEpisodeRegistry _unlockedEpisodes =
UnlockedEpisodeRegistry(); UnlockedEpisodeRegistry();
@@ -218,6 +225,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
// 恢复本地令牌与设备号;未登录也能正常浏览,不阻塞首屏 // 恢复本地令牌与设备号;未登录也能正常浏览,不阻塞首屏
_auth.load(); _auth.load();
unawaited(_localeController.load()); unawaited(_localeController.load());
unawaited(_appConfigController.load());
// 登录/登出时同步收藏状态:收藏属于账号,不能跨账号串联 // 登录/登出时同步收藏状态:收藏属于账号,不能跨账号串联
_auth.addListener(_onAuthChanged); _auth.addListener(_onAuthChanged);
unawaited(_favoriteController.load()); unawaited(_favoriteController.load());
@@ -252,6 +260,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
_walletController.dispose(); _walletController.dispose();
_interactionController.dispose(); _interactionController.dispose();
_localeController.dispose(); _localeController.dispose();
_appConfigController.dispose();
_apiClient.close(); _apiClient.close();
super.dispose(); super.dispose();
} }
@@ -304,6 +313,7 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
ChangeNotifierProvider.value(value: _walletController), ChangeNotifierProvider.value(value: _walletController),
ChangeNotifierProvider.value(value: _interactionController), ChangeNotifierProvider.value(value: _interactionController),
ChangeNotifierProvider.value(value: _localeController), ChangeNotifierProvider.value(value: _localeController),
ChangeNotifierProvider.value(value: _appConfigController),
ChangeNotifierProvider.value(value: _auth), ChangeNotifierProvider.value(value: _auth),
], ],
child: Consumer<LocaleController>( child: Consumer<LocaleController>(
+5 -5
View File
@@ -1,5 +1,7 @@
// Author: fruit.com.cn // Author: fruit.com.cn
import 'package:flutter/foundation.dart';
import 'dev_config.dart'; import 'dev_config.dart';
import 'prod_config.dart'; import 'prod_config.dart';
@@ -9,12 +11,10 @@ import 'prod_config.dart';
/// - `dev_config.dart`:[DevConfig](本机联调) /// - `dev_config.dart`:[DevConfig](本机联调)
/// - `prod_config.dart`:[ProdConfig](生产) /// - `prod_config.dart`:[ProdConfig](生产)
/// ///
/// 切换环境只改下面这一个布尔值,不用传任何构建参数、也不做网络探测。 /// Debug 使用开发环境,Release 自动使用生产环境,不做网络探测。
abstract final class AppConfig { abstract final class AppConfig {
/// **环境开关**:true 用开发环境,false 用生产环境。 /// **环境开关**:Debug 使用开发环境,Release 使用生产环境。
/// static const bool useDevConfig = !kReleaseMode;
/// 打生产包前必须改成 false;release 构建若仍为 true 会在启动时直接报错。
static const bool useDevConfig = true;
/// 当前选中的环境地址。 /// 当前选中的环境地址。
static String get baseUrl => static String get baseUrl =>
+3 -2
View File
@@ -2,8 +2,9 @@
/// 开发环境配置。 /// 开发环境配置。
/// ///
/// 本机联调用:换 Wi-Fi、换网段后只改这里的 [baseUrl],地址不要带结尾斜杠。 /// 本机联调用:模拟器与桌面端可直接用回环地址,但 iOS/Android 真机必须用
/// 开发机的局域网 IP(真机上的 127.0.0.1 指向手机自己)。地址不要带结尾斜杠。
abstract final class DevConfig { 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.243:8081';
} }
+5 -1
View File
@@ -7,7 +7,11 @@ Map<String, String> localeMap(Object? raw) {
} }
/// 按当前语言取文案。没有对应语言时用中文,中文也没有时用 fallback。 /// 按当前语言取文案。没有对应语言时用中文,中文也没有时用 fallback。
String localizedText(String languageCode, String fallback, Map<String, String> locales) { String localizedText(
String languageCode,
String fallback,
Map<String, String> locales,
) {
final selected = locales[languageCode] ?? ''; final selected = locales[languageCode] ?? '';
if (selected.isNotEmpty) return selected; if (selected.isNotEmpty) return selected;
final chinese = locales['zh'] ?? ''; final chinese = locales['zh'] ?? '';
+16
View File
@@ -0,0 +1,16 @@
// Author: fruit.com.cn
import 'api_client.dart';
/// 启动配置:`GET /app/config`(匿名,后台只下发白名单键)。
class ConfigApi {
const ConfigApi(this._client);
final ApiClient _client;
/// 白名单配置表;结构异常时返回空表,调用方按本地默认处理。
Future<Map<String, dynamic>> appConfig() async {
final data = await _client.get('/app/config');
return data is Map<String, dynamic> ? data : const <String, dynamic>{};
}
}
@@ -0,0 +1,31 @@
// Author: fruit.com.cn
import 'package:flutter/foundation.dart';
import '../remote/config_api.dart';
/// 后台下发的启动配置。
///
/// 失败一律静默:拿不到就用 App 内置默认,不阻塞启动、不弹错。
class AppConfigController extends ChangeNotifier {
AppConfigController(this._api);
final ConfigApi _api;
String _loginBackgroundUrl = '';
/// 登录页整屏背景图;空串表示用本地默认图。
String get loginBackgroundUrl => _loginBackgroundUrl;
Future<void> load() async {
try {
final config = await _api.appConfig();
final url = (config['loginBackgroundUrl'] as String? ?? '').trim();
if (url == _loginBackgroundUrl) return;
_loginBackgroundUrl = url;
notifyListeners();
} catch (error) {
debugPrint('[config] load failed: $error');
}
}
}
+14 -5
View File
@@ -21,23 +21,29 @@ class WalletController extends ChangeNotifier {
String? unlockError; String? unlockError;
String? unlockingEpisodeId; String? unlockingEpisodeId;
bool _disposed = false; bool _disposed = false;
int _requestSeq = 0;
int get balance => snapshot?.wallet.coinBalance ?? 0; int get balance => snapshot?.wallet.coinBalance ?? 0;
List<CoinLedgerEntry> get ledger => snapshot?.ledger ?? const []; List<CoinLedgerEntry> get ledger => snapshot?.ledger ?? const [];
Future<void> load() async { Future<void> load() async {
if (_disposed) return;
final request = ++_requestSeq;
loading = true; loading = true;
error = null; error = null;
_notify(); _notify();
try { try {
snapshot = await _repository.fetchWallet(); final result = await _repository.fetchWallet();
if (_isCurrent(request)) snapshot = result;
} on ApiException catch (exception) { } on ApiException catch (exception) {
error = exception.message; if (_isCurrent(request)) error = exception.message;
} catch (_) { } catch (_) {
error = 'walletLoadFailed'; if (_isCurrent(request)) error = 'walletLoadFailed';
} finally { } finally {
loading = false; if (_isCurrent(request)) {
_notify(); loading = false;
_notify();
}
} }
} }
@@ -75,6 +81,7 @@ class WalletController extends ChangeNotifier {
} }
void reset() { void reset() {
_requestSeq += 1;
snapshot = null; snapshot = null;
loading = false; loading = false;
unlocking = false; unlocking = false;
@@ -88,6 +95,8 @@ class WalletController extends ChangeNotifier {
if (!_disposed) notifyListeners(); if (!_disposed) notifyListeners();
} }
bool _isCurrent(int request) => !_disposed && request == _requestSeq;
@override @override
void dispose() { void dispose() {
_disposed = true; _disposed = true;
+31 -5
View File
@@ -27,6 +27,9 @@ abstract final class AppColors {
static const overlaySecondary = Color(0xFFC7C7CC); static const overlaySecondary = Color(0xFFC7C7CC);
static const overlayLabel = Color(0xFFE6E6EB); static const overlayLabel = Color(0xFFE6E6EB);
/// 首页及剧集播放页视频信息文案:参考设计图的 65% 半透明白。
static const homeFeedVideoCopy = Color(0xA6FFFFFF);
/// 主操作、选中态、播放进度。旧品牌橙已全量映射为品牌红(2026-10 改版)。 /// 主操作、选中态、播放进度。旧品牌橙已全量映射为品牌红(2026-10 改版)。
static const blue = Color(0xFFF04E4E); static const blue = Color(0xFFF04E4E);
static const primary = blue; static const primary = blue;
@@ -48,10 +51,20 @@ abstract final class AppColors {
static const vipGoldStart = Color(0xFFF5D9A0); static const vipGoldStart = Color(0xFFF5D9A0);
static const vipGoldEnd = Color(0xFFE8B65A); static const vipGoldEnd = Color(0xFFE8B65A);
/// 「我的」页 VIP 卡的浅香槟金(见设计稿,接近纯色)。 /// 「我的」页 VIP 卡:品牌酒红、暖黑与香槟金共同形成会员层级。
static const vipCardStart = Color(0xFFF6E8C6); static const vipCardStart = Color(0xFF351318);
static const vipCardEnd = Color(0xFFEDD9A8); static const vipCardMiddle = Color(0xFF1B1112);
static const vipBadgeSurface = Color(0x1F3D2408); 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);
static const vipBenefitSurface = Color(0x12FFFFFF);
static const vipBenefitBorder = Color(0x33F5D9A0);
static const vipButtonStart = brandRed;
static const vipButtonEnd = Color(0xFFFF745E);
static const bronze = Color(0xFFCD7F32); static const bronze = Color(0xFFCD7F32);
static const bronzeDeep = Color(0xFFA9713A); static const bronzeDeep = Color(0xFFA9713A);
static const rankSilver = Color(0xFFC0C0C0); static const rankSilver = Color(0xFFC0C0C0);
@@ -113,9 +126,18 @@ abstract final class AppColors {
static const mineGridSurface = Color(0x99101010); static const mineGridSurface = Color(0x99101010);
static const minePanelSurface = Color(0xFF101010); static const minePanelSurface = Color(0xFF101010);
static const mineMoreDivider = Color(0xFF1C1C1E); static const mineMoreDivider = Color(0xFF1C1C1E);
static const mineGridDivider = Color(0xFF2A2A2A); static const mineGridDivider = Color(0x10FFFFFF);
static const mineGridIconSurface = Color(0xFF1C1C1E); static const mineGridIconSurface = Color(0xFF1C1C1E);
static const mineGridLabel = Color(0xFFE6E6EB); static const mineGridLabel = Color(0xFFE6E6EB);
static const mineGridIconAccent = brandRed;
/// 个人数据图标:品牌红的亮面、暗部与暖白反光。
static const mineStatHighlight = Color(0xFFFFAAA3);
static const mineStatShade = Color(0xFFAF263C);
static const mineStatDepth = Color(0xFF681D2B);
static const mineStatGlint = Color(0xFFFFE8E2);
static const mineStatEdge = Color(0x80FFD1CB);
static const mineStatGlow = Color(0x24F04E4E);
static const mineIconWallet = Color(0xFFF5C451); static const mineIconWallet = Color(0xFFF5C451);
static const mineIconDownloads = Color(0xFF4DA3FF); static const mineIconDownloads = Color(0xFF4DA3FF);
static const mineIconHistory = Color(0xFF4ADE80); static const mineIconHistory = Color(0xFF4ADE80);
@@ -134,6 +156,10 @@ abstract final class AppColors {
/// 列表底部「没有更多了」这类弱提示。 /// 列表底部「没有更多了」这类弱提示。
static const textHint = Color(0xFF5C5C60); static const textHint = Color(0xFF5C5C60);
static const textTabInactive = Color(0xFFB0B0B0); static const textTabInactive = Color(0xFFB0B0B0);
/// 首页顶部三项导航未选中文字,略暗于选中白色但保持清晰。
static const homeTabInactive = Color(0xFFC7C7CC);
static const textFilterIcon = Color(0xFF7A7A7E); static const textFilterIcon = Color(0xFF7A7A7E);
static const searchResultMeta = Color(0xFF9E9E9E); static const searchResultMeta = Color(0xFF9E9E9E);
+31 -19
View File
@@ -141,7 +141,7 @@ abstract final class AppDimens {
static const double homePrimarySecondaryGap = 8; static const double homePrimarySecondaryGap = 8;
static const double homeSecondaryGridGap = 10; static const double homeSecondaryGridGap = 10;
static const double homeHeaderIcon = 22; static const double homeHeaderIcon = 22;
static const double homeActionSlot = 40; static const double homeActionSlot = tapTarget;
static const double homeActionIcon = 30; static const double homeActionIcon = 30;
static const double homeActionGap = 6; static const double homeActionGap = 6;
@@ -184,7 +184,7 @@ abstract final class AppDimens {
static const double followingTabFont = 18; static const double followingTabFont = 18;
static const double followingTabGap = 24; static const double followingTabGap = 24;
static const double followingEditIconSize = 20; static const double followingEditIconSize = 20;
static const double followingEditHitSize = 40; static const double followingEditHitSize = tapTarget;
static const double followingAddIconSize = 20; static const double followingAddIconSize = 20;
static const double followingAddIconStroke = 1.5; static const double followingAddIconStroke = 1.5;
static const double followingGridGap = 6; static const double followingGridGap = 6;
@@ -269,32 +269,44 @@ abstract final class AppDimens {
static const double mineGridIconSurface = 44; static const double mineGridIconSurface = 44;
static const double mineGridIcon = 22; static const double mineGridIcon = 22;
static const double mineGridLabel = 12; static const double mineGridLabel = 12;
static const double mineGridLabelLineHeight = 1.15;
static const double mineGridDividerWidth = 1; static const double mineGridDividerWidth = 1;
/// 宫格内部分隔线:0.5pt 发丝线,深色底上比 1pt 更轻。
static const double mineGridHairline = 0.5;
static const int mineGridRows = 2;
static const double mineGridHeight =
mineGridCellHeight * mineGridRows + mineGridHairline;
static const double mineSectionTitleFont = 16; static const double mineSectionTitleFont = 16;
static const double mineSectionLinkFont = 12; static const double mineSectionLinkFont = 12;
static const double mineSectionGap = 12; static const double mineSectionGap = 12;
/// 「我的」页新版:快捷图标行与服务列表。 /// 「我的」页会员卡。高度由内容撑开,上下内边距恒为 [mineVipPadding]。
static const double mineQuickActionIcon = 28; static const double mineVipRadius = 18;
static const double mineQuickActionLabelFont = 14; static const double mineVipPadding = 16;
static const double mineQuickActionGap = 8; static const double mineVipTitleFont = 22;
static const double mineServiceRowHeight = 56; static const double mineVipSubtitleFont = 12;
static const double mineServiceIcon = 24; static const double mineVipEmblem = 48;
static const double mineServiceTitleFont = 16; static const double mineVipEmblemIcon = 28;
static const double mineServiceValueFont = 14; static const double mineVipActionWidth = 100;
static const double mineVipBenefitFont = 14; static const double mineVipBenefitFont = 10.5;
static const double mineVipBenefitIcon = 20; static const double mineVipBenefitBox = 34;
static const double mineVipBenefitBox = 30; static const double mineVipBenefitBoxRadius = 11;
static const double mineVipBenefitBoxRadius = 7; static const double mineVipBenefitGlyph = 19;
static const double mineVipBenefitGlyph = 17; static const double mineVipBenefitRowGap = 6;
static const double mineVipBenefitRowGap = 4; static const double mineVipButtonHeight = tapTarget;
static const double mineVipButtonHeight = 36;
static const double mineContinueCardWidth = 96; static const double mineContinueCardWidth = 96;
static const double mineContinueRowHeight = 172; static const double mineContinueRowHeight = 172;
static const double mineContinueTitleFont = 13; static const double mineContinueTitleFont = 13;
static const double mineContinueMetaFont = 11; static const double mineContinueMetaFont = 11;
static const double mineStatsValueFont = 18; static const double mineStatsValueFont = 24;
static const double mineStatsLabelFont = 11; static const double mineStatsLabelFont = 12;
static const double mineStatsIcon = 42;
static const double mineStatsMinHeight = 104;
static const double mineStatsDividerHeight = 32;
static const double mineStatsDividerWidth = 0.5;
static const double mineStatsValueLineHeight = 1.1;
static const double mineStatsLabelLineHeight = 1.25;
static const double minePanelPadding = 12; static const double minePanelPadding = 12;
static const double mineMoreRowHeight = 52; static const double mineMoreRowHeight = 52;
static const double mineMoreFont = 15; static const double mineMoreFont = 15;
+71
View File
@@ -0,0 +1,71 @@
// Author: fruit.com.cn
// 职责:固定顶部导航文字排版,以绘制缩放和颜色插值实现选中切换。
import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
import '../theme/app_dimens.dart';
const double _inactiveScale = 0.9;
/// 保留最大字号、固定字重与占位,避免选中动画触发相邻标签重新布局。
class AnimatedNavLabel extends StatelessWidget {
/// [style] 指定选中态字号与颜色;字重固定,未指定时默认加粗。
const AnimatedNavLabel({
super.key,
required this.label,
required this.selected,
required this.style,
this.alignment = Alignment.bottomCenter,
this.selectionProgress,
this.inactiveColor = AppColors.textTabInactive,
});
final String label;
final bool selected;
final TextStyle style;
final Alignment alignment;
/// 未选中文字颜色;默认保持通用导航原有灰色。
final Color inactiveColor;
/// 页面拖动时直接使用连续进度,避免再叠加一层延迟动画。
final double? selectionProgress;
@override
Widget build(BuildContext context) {
final target = selected ? 1.0 : 0.0;
final reduceMotion = MediaQuery.disableAnimationsOf(context);
return Semantics(
selected: selected,
child: selectionProgress != null
? _label(selectionProgress!.clamp(0.0, 1.0))
: TweenAnimationBuilder<double>(
tween: Tween(begin: target, end: target),
duration: reduceMotion
? Duration.zero
: AppDimens.homePrimaryTabAnimationDuration,
curve: Curves.easeOut,
builder: (context, progress, _) => _label(progress),
),
);
}
Widget _label(double progress) => Transform.scale(
scale: _inactiveScale + (1 - _inactiveScale) * progress,
alignment: alignment,
child: Text(
label,
maxLines: 1,
textAlign: TextAlign.left,
style: style.copyWith(
fontWeight: style.fontWeight ?? FontWeight.w700,
letterSpacing: 0,
color: Color.lerp(
inactiveColor,
style.color ?? AppColors.textPrimary,
progress,
),
),
),
);
}
+13 -8
View File
@@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import '../theme/app_colors.dart'; import '../theme/app_colors.dart';
import '../theme/app_dimens.dart'; import '../theme/app_dimens.dart';
const double _maxNavigationTextScale = 1.3;
/// 底部导航普通目的地。 /// 底部导航普通目的地。
class AppBottomNavItem { class AppBottomNavItem {
const AppBottomNavItem({ const AppBottomNavItem({
@@ -41,14 +43,17 @@ class AppBottomNav extends StatelessWidget {
key: barKey, key: barKey,
height: AppDimens.navHeight, height: AppDimens.navHeight,
color: AppColors.navBackground, color: AppColors.navBackground,
child: Row( child: MediaQuery.withClampedTextScaling(
children: [ maxScaleFactor: _maxNavigationTextScale,
for (final item in items) child: Row(
_NavDestination( children: [
item: item, for (final item in items)
unselectedColor: AppColors.navUnselected, _NavDestination(
), item: item,
], unselectedColor: AppColors.navUnselected,
),
],
),
), ),
); );
return ColoredBox( return ColoredBox(
+2 -2
View File
@@ -25,14 +25,14 @@ extension AppRootTabUi on AppRootTab {
IconData get icon => switch (this) { IconData get icon => switch (this) {
AppRootTab.home => Icons.home_outlined, AppRootTab.home => Icons.home_outlined,
AppRootTab.recommend => Icons.celebration_outlined, AppRootTab.recommend => Icons.smart_display_outlined,
AppRootTab.following => Icons.bookmark_border_rounded, AppRootTab.following => Icons.bookmark_border_rounded,
AppRootTab.mine => Icons.person_outline_rounded, AppRootTab.mine => Icons.person_outline_rounded,
}; };
IconData get selectedIcon => switch (this) { IconData get selectedIcon => switch (this) {
AppRootTab.home => Icons.home_rounded, AppRootTab.home => Icons.home_rounded,
AppRootTab.recommend => Icons.celebration_rounded, AppRootTab.recommend => Icons.smart_display_rounded,
AppRootTab.following => Icons.bookmark_rounded, AppRootTab.following => Icons.bookmark_rounded,
AppRootTab.mine => Icons.person_rounded, AppRootTab.mine => Icons.person_rounded,
}; };
@@ -0,0 +1,86 @@
// 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;
}
+17 -4
View File
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../config/app_config.dart'; import '../config/app_config.dart';
import '../theme/app_colors.dart'; import '../theme/app_colors.dart';
import 'image_placeholder_shimmer.dart';
const int _minImageDecodePixels = 96; const int _minImageDecodePixels = 96;
const int _maxImageDecodePixels = 2048; const int _maxImageDecodePixels = 2048;
@@ -35,6 +36,7 @@ class RemoteImage extends StatelessWidget {
this.fallbackIconKey, this.fallbackIconKey,
this.fallbackAspectRatio, this.fallbackAspectRatio,
this.fallbackColor = AppColors.raised, this.fallbackColor = AppColors.raised,
this.fallbackWidget,
this.decodeWidth, this.decodeWidth,
this.decodeHeight, this.decodeHeight,
}); });
@@ -47,6 +49,9 @@ class RemoteImage extends StatelessWidget {
final Key? fallbackIconKey; final Key? fallbackIconKey;
final double? fallbackAspectRatio; final double? fallbackAspectRatio;
final Color fallbackColor; final Color fallbackColor;
/// 自定义兜底:地址为空、加载中、加载失败时都显示它(优先于 [fallbackColor])。
final Widget? fallbackWidget;
final int? decodeWidth; final int? decodeWidth;
final int? decodeHeight; final int? decodeHeight;
@@ -77,9 +82,9 @@ class RemoteImage extends StatelessWidget {
// cover/contain 本身会保持宽高比,此时若同时强制 cacheWidth 和 // cover/contain 本身会保持宽高比,此时若同时强制 cacheWidth 和
// cacheHeight,解码会把竖版图强行拉成横版像素。只在显式指定了 // cacheHeight,解码会把竖版图强行拉成横版像素。只在显式指定了
// decodeHeight、或 fit 不保持宽高比时才限定解码高度。 // decodeHeight、或 fit 不保持宽高比时才限定解码高度。
final keepsAspectRatio = final keepsAspectRatio = fit == BoxFit.cover || fit == BoxFit.contain;
fit == BoxFit.cover || fit == BoxFit.contain; final cacheHeight =
final cacheHeight = decodeHeight ?? decodeHeight ??
(keepsAspectRatio || inferredHeight == null (keepsAspectRatio || inferredHeight == null
? null ? null
: resolveImageDecodePixels(inferredHeight, pixelRatio)); : resolveImageDecodePixels(inferredHeight, pixelRatio));
@@ -98,14 +103,22 @@ class RemoteImage extends StatelessWidget {
errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon), errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon),
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) { frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
if (wasSynchronouslyLoaded || frame != null) return child; if (wasSynchronouslyLoaded || frame != null) return child;
return _fallback(brand: showFallbackIcon); return _loadingFallback();
}, },
); );
}, },
); );
} }
Widget _loadingFallback() {
final custom = fallbackWidget;
if (custom != null) return custom;
return ImagePlaceholderShimmer(child: _fallback(brand: showFallbackIcon));
}
Widget _fallback({required bool brand}) { Widget _fallback({required bool brand}) {
final custom = fallbackWidget;
if (custom != null) return custom;
final mark = brand final mark = brand
? LayoutBuilder( ? LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
+7 -6
View File
@@ -1,6 +1,6 @@
{ {
"@@locale": "en", "@@locale": "en",
"appName": "FruitShorts", "appName": "ymb",
"demo": "DEMO", "demo": "DEMO",
"homeHeadline": "Watch now", "homeHeadline": "Watch now",
"homeSubtitle": "Free short drama preview.", "homeSubtitle": "Free short drama preview.",
@@ -19,7 +19,7 @@
"searchCancel": "Cancel", "searchCancel": "Cancel",
"featured": "Featured", "featured": "Featured",
"recommended": "Recommended", "recommended": "Recommended",
"fruitShortsBrand": "FruitShorts", "fruitShortsBrand": "ymb",
"comingSoon": "Coming soon", "comingSoon": "Coming soon",
"authLegal": "By continuing, you agree to the Terms of Service and Privacy Policy.", "authLegal": "By continuing, you agree to the Terms of Service and Privacy Policy.",
"authLegalLead": "By continuing, you agree to the", "authLegalLead": "By continuing, you agree to the",
@@ -408,8 +408,8 @@
"genreDramaMystery": "Drama · Mystery", "genreDramaMystery": "Drama · Mystery",
"continueWatchingHeading": "CONTINUE WATCHING", "continueWatchingHeading": "CONTINUE WATCHING",
"preferencesHeading": "PREFERENCES", "preferencesHeading": "PREFERENCES",
"brandMark": "FRUITSHORTS", "brandMark": "YMB",
"shareFooter": "FruitShorts", "shareFooter": "ymb",
"shortsTab": "Shorts", "shortsTab": "Shorts",
"myListTab": "My List", "myListTab": "My List",
"watchFull": "Watch Full", "watchFull": "Watch Full",
@@ -761,7 +761,7 @@
"homeBadgeNew": "New", "homeBadgeNew": "New",
"homeBadgeAnime": "Anime", "homeBadgeAnime": "Anime",
"emptyContent": "No content yet", "emptyContent": "No content yet",
"recommendTopTab": "Recommend", "recommendTopTab": "Featured",
"playlistTopTab": "Playlists", "playlistTopTab": "Playlists",
"allDramasTopTab": "All Dramas", "allDramasTopTab": "All Dramas",
"weeklyHitsTitle": "This Week's Hits", "weeklyHitsTitle": "This Week's Hits",
@@ -789,7 +789,7 @@
"offlineDownloads": "Downloads", "offlineDownloads": "Downloads",
"watchPreferences": "Watch preferences", "watchPreferences": "Watch preferences",
"contactSupport": "Contact support", "contactSupport": "Contact support",
"vipBrandName": "FruitShorts VIP", "vipBrandName": "VIP",
"vipOpenNow": "Get VIP", "vipOpenNow": "Get VIP",
"vipBenefitFree": "Free full access", "vipBenefitFree": "Free full access",
"vipBenefitNoAds": "Ad-free viewing", "vipBenefitNoAds": "Ad-free viewing",
@@ -851,6 +851,7 @@
"dataUnavailable": "—", "dataUnavailable": "—",
"commonQuestions": "Common questions", "commonQuestions": "Common questions",
"aboutUs": "About us", "aboutUs": "About us",
"aboutBrandName": "Your mini business",
"aboutDescription": "A focused, immersive place to watch short dramas.", "aboutDescription": "A focused, immersive place to watch short dramas.",
"versionLabel": "Version {version}", "versionLabel": "Version {version}",
"@versionLabel": { "@versionLabel": {
+7 -6
View File
@@ -1,6 +1,6 @@
{ {
"@@locale": "id", "@@locale": "id",
"appName": "FruitShorts", "appName": "ymb",
"demo": "Demo", "demo": "Demo",
"homeHeadline": "Tonton sekarang", "homeHeadline": "Tonton sekarang",
"homeSubtitle": "Pratinjau drama pendek gratis.", "homeSubtitle": "Pratinjau drama pendek gratis.",
@@ -19,7 +19,7 @@
"searchCancel": "Batal", "searchCancel": "Batal",
"featured": "Unggulan", "featured": "Unggulan",
"recommended": "Rekomendasi", "recommended": "Rekomendasi",
"fruitShortsBrand": "FruitShorts", "fruitShortsBrand": "ymb",
"comingSoon": "Segera hadir", "comingSoon": "Segera hadir",
"authLegal": "Dengan melanjutkan, Anda menyetujui Ketentuan Layanan dan Kebijakan Privasi.", "authLegal": "Dengan melanjutkan, Anda menyetujui Ketentuan Layanan dan Kebijakan Privasi.",
"authLegalLead": "Dengan melanjutkan, Anda menyetujui", "authLegalLead": "Dengan melanjutkan, Anda menyetujui",
@@ -387,8 +387,8 @@
"genreDramaMystery": "Drama · Misteri", "genreDramaMystery": "Drama · Misteri",
"continueWatchingHeading": "LANJUT TONTON", "continueWatchingHeading": "LANJUT TONTON",
"preferencesHeading": "PREFERENSI", "preferencesHeading": "PREFERENSI",
"brandMark": "FRUITSHORTS", "brandMark": "YMB",
"shareFooter": "FruitShorts", "shareFooter": "ymb",
"shortsTab": "Drama Pendek", "shortsTab": "Drama Pendek",
"myListTab": "Daftar Saya", "myListTab": "Daftar Saya",
"watchFull": "Tonton Penuh", "watchFull": "Tonton Penuh",
@@ -723,7 +723,7 @@
"homeBadgeNew": "Baru", "homeBadgeNew": "Baru",
"homeBadgeAnime": "Anime", "homeBadgeAnime": "Anime",
"emptyContent": "Belum ada konten", "emptyContent": "Belum ada konten",
"recommendTopTab": "Rekomendasi", "recommendTopTab": "Unggulan",
"playlistTopTab": "Daftar Putar", "playlistTopTab": "Daftar Putar",
"allDramasTopTab": "Semua", "allDramasTopTab": "Semua",
"weeklyHitsTitle": "Hits Minggu Ini", "weeklyHitsTitle": "Hits Minggu Ini",
@@ -751,7 +751,7 @@
"offlineDownloads": "Unduhan", "offlineDownloads": "Unduhan",
"watchPreferences": "Preferensi tontonan", "watchPreferences": "Preferensi tontonan",
"contactSupport": "Hubungi dukungan", "contactSupport": "Hubungi dukungan",
"vipBrandName": "FruitShorts VIP", "vipBrandName": "VIP",
"vipOpenNow": "Buka VIP", "vipOpenNow": "Buka VIP",
"vipBenefitFree": "Nonton semua gratis", "vipBenefitFree": "Nonton semua gratis",
"vipBenefitNoAds": "Bebas iklan", "vipBenefitNoAds": "Bebas iklan",
@@ -813,6 +813,7 @@
"dataUnavailable": "—", "dataUnavailable": "—",
"commonQuestions": "Pertanyaan umum", "commonQuestions": "Pertanyaan umum",
"aboutUs": "Tentang kami", "aboutUs": "Tentang kami",
"aboutBrandName": "Your mini business",
"aboutDescription": "Tempat fokus dan imersif untuk menonton drama pendek.", "aboutDescription": "Tempat fokus dan imersif untuk menonton drama pendek.",
"versionLabel": "Versi {version}", "versionLabel": "Versi {version}",
"@versionLabel": { "@versionLabel": {
+12 -6
View File
@@ -103,7 +103,7 @@ abstract class AppLocalizations {
/// No description provided for @appName. /// No description provided for @appName.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'FruitShorts'** /// **'ymb'**
String get appName; String get appName;
/// No description provided for @demo. /// No description provided for @demo.
@@ -217,7 +217,7 @@ abstract class AppLocalizations {
/// No description provided for @fruitShortsBrand. /// No description provided for @fruitShortsBrand.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'FruitShorts'** /// **'ymb'**
String get fruitShortsBrand; String get fruitShortsBrand;
/// No description provided for @comingSoon. /// No description provided for @comingSoon.
@@ -1627,13 +1627,13 @@ abstract class AppLocalizations {
/// No description provided for @brandMark. /// No description provided for @brandMark.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'FRUITSHORTS'** /// **'YMB'**
String get brandMark; String get brandMark;
/// No description provided for @shareFooter. /// No description provided for @shareFooter.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'FruitShorts'** /// **'ymb'**
String get shareFooter; String get shareFooter;
/// No description provided for @shortsTab. /// No description provided for @shortsTab.
@@ -3271,7 +3271,7 @@ abstract class AppLocalizations {
/// No description provided for @recommendTopTab. /// No description provided for @recommendTopTab.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'Recommend'** /// **'Featured'**
String get recommendTopTab; String get recommendTopTab;
/// No description provided for @playlistTopTab. /// No description provided for @playlistTopTab.
@@ -3439,7 +3439,7 @@ abstract class AppLocalizations {
/// No description provided for @vipBrandName. /// No description provided for @vipBrandName.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'FruitShorts VIP'** /// **'VIP'**
String get vipBrandName; String get vipBrandName;
/// No description provided for @vipOpenNow. /// No description provided for @vipOpenNow.
@@ -3592,6 +3592,12 @@ abstract class AppLocalizations {
/// **'About us'** /// **'About us'**
String get aboutUs; String get aboutUs;
/// No description provided for @aboutBrandName.
///
/// In en, this message translates to:
/// **'Your mini business'**
String get aboutBrandName;
/// No description provided for @aboutDescription. /// No description provided for @aboutDescription.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
+9 -6
View File
@@ -9,7 +9,7 @@ class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale); AppLocalizationsEn([String locale = 'en']) : super(locale);
@override @override
String get appName => 'FruitShorts'; String get appName => 'ymb';
@override @override
String get demo => 'DEMO'; String get demo => 'DEMO';
@@ -67,7 +67,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get recommended => 'Recommended'; String get recommended => 'Recommended';
@override @override
String get fruitShortsBrand => 'FruitShorts'; String get fruitShortsBrand => 'ymb';
@override @override
String get comingSoon => 'Coming soon'; String get comingSoon => 'Coming soon';
@@ -831,10 +831,10 @@ class AppLocalizationsEn extends AppLocalizations {
String get preferencesHeading => 'PREFERENCES'; String get preferencesHeading => 'PREFERENCES';
@override @override
String get brandMark => 'FRUITSHORTS'; String get brandMark => 'YMB';
@override @override
String get shareFooter => 'FruitShorts'; String get shareFooter => 'ymb';
@override @override
String get shortsTab => 'Shorts'; String get shortsTab => 'Shorts';
@@ -1711,7 +1711,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get emptyContent => 'No content yet'; String get emptyContent => 'No content yet';
@override @override
String get recommendTopTab => 'Recommend'; String get recommendTopTab => 'Featured';
@override @override
String get playlistTopTab => 'Playlists'; String get playlistTopTab => 'Playlists';
@@ -1795,7 +1795,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get contactSupport => 'Contact support'; String get contactSupport => 'Contact support';
@override @override
String get vipBrandName => 'FruitShorts VIP'; String get vipBrandName => 'VIP';
@override @override
String get vipOpenNow => 'Get VIP'; String get vipOpenNow => 'Get VIP';
@@ -1886,6 +1886,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get aboutUs => 'About us'; String get aboutUs => 'About us';
@override
String get aboutBrandName => 'Your mini business';
@override @override
String get aboutDescription => String get aboutDescription =>
'A focused, immersive place to watch short dramas.'; 'A focused, immersive place to watch short dramas.';
+9 -6
View File
@@ -9,7 +9,7 @@ class AppLocalizationsId extends AppLocalizations {
AppLocalizationsId([String locale = 'id']) : super(locale); AppLocalizationsId([String locale = 'id']) : super(locale);
@override @override
String get appName => 'FruitShorts'; String get appName => 'ymb';
@override @override
String get demo => 'Demo'; String get demo => 'Demo';
@@ -67,7 +67,7 @@ class AppLocalizationsId extends AppLocalizations {
String get recommended => 'Rekomendasi'; String get recommended => 'Rekomendasi';
@override @override
String get fruitShortsBrand => 'FruitShorts'; String get fruitShortsBrand => 'ymb';
@override @override
String get comingSoon => 'Segera hadir'; String get comingSoon => 'Segera hadir';
@@ -834,10 +834,10 @@ class AppLocalizationsId extends AppLocalizations {
String get preferencesHeading => 'PREFERENSI'; String get preferencesHeading => 'PREFERENSI';
@override @override
String get brandMark => 'FRUITSHORTS'; String get brandMark => 'YMB';
@override @override
String get shareFooter => 'FruitShorts'; String get shareFooter => 'ymb';
@override @override
String get shortsTab => 'Drama Pendek'; String get shortsTab => 'Drama Pendek';
@@ -1711,7 +1711,7 @@ class AppLocalizationsId extends AppLocalizations {
String get emptyContent => 'Belum ada konten'; String get emptyContent => 'Belum ada konten';
@override @override
String get recommendTopTab => 'Rekomendasi'; String get recommendTopTab => 'Unggulan';
@override @override
String get playlistTopTab => 'Daftar Putar'; String get playlistTopTab => 'Daftar Putar';
@@ -1797,7 +1797,7 @@ class AppLocalizationsId extends AppLocalizations {
String get contactSupport => 'Hubungi dukungan'; String get contactSupport => 'Hubungi dukungan';
@override @override
String get vipBrandName => 'FruitShorts VIP'; String get vipBrandName => 'VIP';
@override @override
String get vipOpenNow => 'Buka VIP'; String get vipOpenNow => 'Buka VIP';
@@ -1888,6 +1888,9 @@ class AppLocalizationsId extends AppLocalizations {
@override @override
String get aboutUs => 'Tentang kami'; String get aboutUs => 'Tentang kami';
@override
String get aboutBrandName => 'Your mini business';
@override @override
String get aboutDescription => String get aboutDescription =>
'Tempat fokus dan imersif untuk menonton drama pendek.'; 'Tempat fokus dan imersif untuk menonton drama pendek.';
+9 -6
View File
@@ -9,7 +9,7 @@ class AppLocalizationsZh extends AppLocalizations {
AppLocalizationsZh([String locale = 'zh']) : super(locale); AppLocalizationsZh([String locale = 'zh']) : super(locale);
@override @override
String get appName => 'FruitShorts'; String get appName => 'ymb';
@override @override
String get demo => '演示'; String get demo => '演示';
@@ -66,7 +66,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get recommended => '推荐'; String get recommended => '推荐';
@override @override
String get fruitShortsBrand => 'FruitShorts'; String get fruitShortsBrand => 'ymb';
@override @override
String get comingSoon => '即将上线'; String get comingSoon => '即将上线';
@@ -821,10 +821,10 @@ class AppLocalizationsZh extends AppLocalizations {
String get preferencesHeading => '偏好设置'; String get preferencesHeading => '偏好设置';
@override @override
String get brandMark => 'FRUITSHORTS'; String get brandMark => 'YMB';
@override @override
String get shareFooter => 'FruitShorts'; String get shareFooter => 'ymb';
@override @override
String get shortsTab => '短剧'; String get shortsTab => '短剧';
@@ -1686,7 +1686,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get emptyContent => '暂无内容'; String get emptyContent => '暂无内容';
@override @override
String get recommendTopTab => '推荐'; String get recommendTopTab => '精选';
@override @override
String get playlistTopTab => '剧单'; String get playlistTopTab => '剧单';
@@ -1770,7 +1770,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get contactSupport => '联系客服'; String get contactSupport => '联系客服';
@override @override
String get vipBrandName => 'FruitShorts VIP'; String get vipBrandName => 'VIP';
@override @override
String get vipOpenNow => '立即开通'; String get vipOpenNow => '立即开通';
@@ -1861,6 +1861,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override @override
String get aboutUs => '关于我们'; String get aboutUs => '关于我们';
@override
String get aboutBrandName => 'Your mini business';
@override @override
String get aboutDescription => '专注于短剧观看与沉浸式追剧体验。'; String get aboutDescription => '专注于短剧观看与沉浸式追剧体验。';
+7 -6
View File
@@ -1,6 +1,6 @@
{ {
"@@locale": "zh", "@@locale": "zh",
"appName": "FruitShorts", "appName": "ymb",
"demo": "演示", "demo": "演示",
"homeHeadline": "即刻观看", "homeHeadline": "即刻观看",
"homeSubtitle": "免费短剧预览。", "homeSubtitle": "免费短剧预览。",
@@ -19,7 +19,7 @@
"searchCancel": "取消", "searchCancel": "取消",
"featured": "精选", "featured": "精选",
"recommended": "推荐", "recommended": "推荐",
"fruitShortsBrand": "FruitShorts", "fruitShortsBrand": "ymb",
"comingSoon": "即将上线", "comingSoon": "即将上线",
"authLegal": "继续即代表同意《用户协议》与《隐私政策》", "authLegal": "继续即代表同意《用户协议》与《隐私政策》",
"authLegalLead": "继续即代表同意", "authLegalLead": "继续即代表同意",
@@ -349,8 +349,8 @@
"genreDramaMystery": "剧情 · 悬疑", "genreDramaMystery": "剧情 · 悬疑",
"continueWatchingHeading": "继续观看", "continueWatchingHeading": "继续观看",
"preferencesHeading": "偏好设置", "preferencesHeading": "偏好设置",
"brandMark": "FRUITSHORTS", "brandMark": "YMB",
"shareFooter": "FruitShorts", "shareFooter": "ymb",
"shortsTab": "短剧", "shortsTab": "短剧",
"myListTab": "片单", "myListTab": "片单",
"watchFull": "看全集", "watchFull": "看全集",
@@ -685,7 +685,7 @@
"homeBadgeNew": "新剧", "homeBadgeNew": "新剧",
"homeBadgeAnime": "漫剧", "homeBadgeAnime": "漫剧",
"emptyContent": "暂无内容", "emptyContent": "暂无内容",
"recommendTopTab": "推荐", "recommendTopTab": "精选",
"playlistTopTab": "剧单", "playlistTopTab": "剧单",
"allDramasTopTab": "全部短剧", "allDramasTopTab": "全部短剧",
"weeklyHitsTitle": "本週爆款推薦", "weeklyHitsTitle": "本週爆款推薦",
@@ -713,7 +713,7 @@
"offlineDownloads": "离线缓存", "offlineDownloads": "离线缓存",
"watchPreferences": "观看偏好", "watchPreferences": "观看偏好",
"contactSupport": "联系客服", "contactSupport": "联系客服",
"vipBrandName": "FruitShorts VIP", "vipBrandName": "VIP",
"vipOpenNow": "立即开通", "vipOpenNow": "立即开通",
"vipBenefitFree": "全剧免费看", "vipBenefitFree": "全剧免费看",
"vipBenefitNoAds": "免广告打扰", "vipBenefitNoAds": "免广告打扰",
@@ -775,6 +775,7 @@
"dataUnavailable": "—", "dataUnavailable": "—",
"commonQuestions": "常见问题", "commonQuestions": "常见问题",
"aboutUs": "关于我们", "aboutUs": "关于我们",
"aboutBrandName": "Your mini business",
"aboutDescription": "专注于短剧观看与沉浸式追剧体验。", "aboutDescription": "专注于短剧观看与沉浸式追剧体验。",
"versionLabel": "版本 {version}", "versionLabel": "版本 {version}",
"@versionLabel": { "@versionLabel": {
+9 -27
View File
@@ -300,7 +300,7 @@ class _AuthBrand extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final copy = _brandCopy(context, centered: !compact); final copy = _brandCopy(centered: !compact);
if (compact) { if (compact) {
return Row( return Row(
key: const Key('auth-brand'), key: const Key('auth-brand'),
@@ -324,32 +324,14 @@ class _AuthBrand extends StatelessWidget {
radius: compact ? _compactBrandMarkRadius : _brandMarkRadius, radius: compact ? _compactBrandMarkRadius : _brandMarkRadius,
); );
Widget _brandCopy(BuildContext context, {required bool centered}) => Column( Widget _brandCopy({required bool centered}) => Text(
crossAxisAlignment: centered tagline,
? CrossAxisAlignment.center textAlign: centered ? TextAlign.center : TextAlign.start,
: CrossAxisAlignment.start, style: const TextStyle(
children: [ color: AppColors.muted,
Text( fontSize: 13,
AppLocalizations.of(context)!.appName, height: 1.35,
textAlign: centered ? TextAlign.center : TextAlign.start, ),
style: const TextStyle(
color: AppColors.onSurface,
fontSize: 24,
fontWeight: FontWeight.w700,
height: 1.1,
),
),
const SizedBox(height: 6),
Text(
tagline,
textAlign: centered ? TextAlign.center : TextAlign.start,
style: const TextStyle(
color: AppColors.muted,
fontSize: 13,
height: 1.35,
),
),
],
); );
} }
+71 -74
View File
@@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import '../../core/data/remote/api_client.dart'; import '../../core/data/remote/api_client.dart';
import '../../core/formatting/error_text.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/auth_controller.dart';
import '../../core/platform/haptics.dart'; import '../../core/platform/haptics.dart';
import '../../core/platform/keyboard_inset.dart'; import '../../core/platform/keyboard_inset.dart';
@@ -14,6 +15,7 @@ import '../../core/theme/app_colors.dart';
import '../../core/theme/app_dimens.dart'; import '../../core/theme/app_dimens.dart';
import '../../core/theme/app_theme.dart'; import '../../core/theme/app_theme.dart';
import '../../core/widgets/centered_toast.dart'; import '../../core/widgets/centered_toast.dart';
import '../../core/widgets/remote_image.dart';
import '../../core/widgets/subpage_header.dart'; import '../../core/widgets/subpage_header.dart';
import '../../l10n/app_localizations.dart'; import '../../l10n/app_localizations.dart';
import 'auth_legal_links.dart'; import 'auth_legal_links.dart';
@@ -28,7 +30,7 @@ const double _brandMarkSize = 88;
const double _compactBrandMarkSize = 48; const double _compactBrandMarkSize = 48;
const double _brandMarkRadius = 26; const double _brandMarkRadius = 26;
const double _compactBrandMarkRadius = 14; const double _compactBrandMarkRadius = 14;
const String _appLogoAsset = 'assets/icon/fruitshorts.png'; const String _appLogoAsset = 'assets/icon/ymb.png';
const double _contentMaxWidth = 440; const double _contentMaxWidth = 440;
const double _fieldHeight = 52; const double _fieldHeight = 52;
const double _fieldRadius = 12; const double _fieldRadius = 12;
@@ -276,9 +278,7 @@ class _AuthPageState extends State<AuthPage> {
), ),
), ),
// 全屏海报背景:压暗保证文字可读,顶部再叠品牌红光。 // 全屏海报背景:压暗保证文字可读,顶部再叠品牌红光。
Positioned.fill( Positioned.fill(child: IgnorePointer(child: _AuthPosterBackdrop())),
child: IgnorePointer(child: _AuthPosterBackdrop()),
),
const Positioned.fill( const Positioned.fill(
child: IgnorePointer( child: IgnorePointer(
child: DecoratedBox( child: DecoratedBox(
@@ -396,80 +396,67 @@ class _AuthPageState extends State<AuthPage> {
AppLocalizations l10n, { AppLocalizations l10n, {
required bool compact, required bool compact,
required double minHeight, required double minHeight,
}) => }) => TweenAnimationBuilder<double>(
TweenAnimationBuilder<double>( key: const Key('auth-enter-animation'),
key: const Key('auth-enter-animation'), tween: Tween(begin: 0, end: 1),
tween: Tween(begin: 0, end: 1), duration: _enterDuration,
duration: _enterDuration, curve: Curves.easeOutCubic,
curve: Curves.easeOutCubic, builder: (context, value, child) => Opacity(
builder: (context, value, child) => Opacity( opacity: value,
opacity: value, child: Transform.translate(
child: Transform.translate( offset: Offset(0, _enterSlideDistance * (1 - value)),
offset: Offset(0, _enterSlideDistance * (1 - value)), child: child,
child: child, ),
), ),
), child: _emailEntryOpen
child: _emailEntryOpen ? Column(
? Column( crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch, children: [
children: [ _AuthBrand(tagline: l10n.authBrandTagline, compact: compact),
_AuthBrand(tagline: l10n.authBrandTagline, compact: compact), SizedBox(height: compact ? _compactBrandGap : 28),
SizedBox(height: compact ? _compactBrandGap : 28), _authCard(l10n),
_authCard(l10n), ],
], )
) : _landing(l10n, minHeight: minHeight),
: _landing(l10n, minHeight: minHeight), );
);
/// 落地页内容需要有限高度才能用 Spacer 三段分割,这里显式钉住可用高度。 /// 落地页内容需要有限高度才能用 Spacer 三段分割,这里显式钉住可用高度。
Widget _landing(AppLocalizations l10n, {required double minHeight}) => Widget _landing(AppLocalizations l10n, {required double minHeight}) =>
SizedBox( SizedBox(
height: minHeight, height: minHeight,
child: Column( child: Column(
key: const Key('auth-landing'), key: const Key('auth-landing'),
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const Spacer(flex: 5), const Spacer(flex: 5),
Center( Center(
child: _brandMarkWidget( child: _brandMarkWidget(
key: const Key('auth-brand-logo'), key: const Key('auth-brand-logo'),
size: _brandMarkSize, size: _brandMarkSize,
radius: _brandMarkRadius, radius: _brandMarkRadius,
),
),
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,
onTap: () => setState(() => _emailEntryOpen = true),
),
const SizedBox(height: 14),
const Opacity(opacity: 0.75, child: AuthLegalLinks()),
const Spacer(flex: 6),
],
), ),
),
const SizedBox(height: 10),
Text(
l10n.fruitShortsBrand,
textAlign: TextAlign.center,
style: const TextStyle(
fontFamily: 'Outfit',
color: AppColors.onSurface,
fontSize: 26,
fontWeight: FontWeight.w700,
letterSpacing: 2,
),
),
const Spacer(flex: 3),
_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,
onTap: () => setState(() => _emailEntryOpen = true),
),
const SizedBox(height: 14),
const Opacity(opacity: 0.75, child: AuthLegalLinks()),
const Spacer(flex: 6),
],
),
); );
Future<void> _openPhoneSheet() async { Future<void> _openPhoneSheet() async {
@@ -578,16 +565,26 @@ class _AuthEntryButton extends StatelessWidget {
} }
/// 登录页全屏海报背景(单张,无拼缝)。 /// 登录页全屏海报背景(单张,无拼缝)。
///
/// 优先用后台下发的 `loginBackgroundUrl`(后台未配置或加载失败时回落到本地默认图)。
class _AuthPosterBackdrop extends StatelessWidget { class _AuthPosterBackdrop extends StatelessWidget {
const _AuthPosterBackdrop(); const _AuthPosterBackdrop();
static const String _defaultAsset = 'assets/auth/bg_3.jpg';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Image.asset( final remoteUrl = context.watch<AppConfigController>().loginBackgroundUrl;
return RemoteImage(
key: const Key('auth-poster-backdrop'), key: const Key('auth-poster-backdrop'),
'assets/auth/bg_3.jpg', remoteUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: Alignment.center, fallbackWidget: Image.asset(
_defaultAsset,
key: const Key('auth-poster-default'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
); );
} }
} }
@@ -1,22 +1,18 @@
// Author: fruit.com.cn // Author: fruit.com.cn
// 职责:追剧收藏网格、分页和编辑选择,不承载顶部续播或重复区块标题。
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../core/data/models/watch_record.dart';
import '../../core/data/services/favorite_controller.dart'; import '../../core/data/services/favorite_controller.dart';
import '../../core/data/services/watch_records_controller.dart';
import '../../core/formatting/error_text.dart'; import '../../core/formatting/error_text.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_dimens.dart';
import '../../core/widgets/empty_state.dart'; import '../../core/widgets/empty_state.dart';
import '../../l10n/app_localizations.dart'; import '../../l10n/app_localizations.dart';
import '../player/open_player.dart'; import '../player/open_player.dart';
import 'following_grid_card.dart'; import 'following_grid_card.dart';
import 'following_paged_grid.dart'; import 'following_paged_grid.dart';
import 'widgets/continue_watching_banner.dart';
/// 追剧编辑中的选中状态。 /// 追剧编辑中的选中状态。
class FollowingFavoriteSelection { class FollowingFavoriteSelection {
@@ -36,19 +32,15 @@ class FollowingFavoritesGrid extends StatelessWidget {
const FollowingFavoritesGrid({ const FollowingFavoritesGrid({
super.key, super.key,
required this.controller, required this.controller,
required this.history,
required this.selection, required this.selection,
required this.scrollController, required this.scrollController,
required this.onGoHome, required this.onGoHome,
required this.onContinueRecord,
}); });
final FavoriteController controller; final FavoriteController controller;
final WatchRecordsController history;
final FollowingFavoriteSelection selection; final FollowingFavoriteSelection selection;
final ScrollController scrollController; final ScrollController scrollController;
final VoidCallback onGoHome; final VoidCallback onGoHome;
final ValueChanged<WatchRecord> onContinueRecord;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -59,7 +51,7 @@ class FollowingFavoritesGrid extends StatelessWidget {
valueListenable: selection.selected, valueListenable: selection.selected,
builder: (context, picked, _) { builder: (context, picked, _) {
return ListenableBuilder( return ListenableBuilder(
listenable: Listenable.merge([controller, history]), listenable: controller,
builder: (context, _) => _grid(context, isEditing, picked), builder: (context, _) => _grid(context, isEditing, picked),
); );
}, },
@@ -89,7 +81,6 @@ class FollowingFavoritesGrid extends StatelessWidget {
onRefresh: controller.load, onRefresh: controller.load,
onLoadMore: controller.loadMore, onLoadMore: controller.loadMore,
itemCount: controller.cards.length + extra, itemCount: controller.cards.length + extra,
topSlivers: _topSlivers(context),
empty: EmptyState( empty: EmptyState(
key: const Key('following-favorites-empty'), key: const Key('following-favorites-empty'),
icon: Icons.bookmark_border_rounded, icon: Icons.bookmark_border_rounded,
@@ -99,68 +90,6 @@ class FollowingFavoritesGrid extends StatelessWidget {
); );
} }
List<Widget> _topSlivers(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final continueRecord = _continueRecord();
return [
if (continueRecord != null)
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.fromLTRB(
AppDimens.feedPageHorizontal,
4,
AppDimens.feedPageHorizontal,
0,
),
child: ContinueWatchingBanner(
record: continueRecord,
languageCode: Localizations.localeOf(context).languageCode,
onTap: () => onContinueRecord(continueRecord),
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.fromLTRB(
AppDimens.feedPageHorizontal,
AppDimens.followingSectionTopGap,
AppDimens.feedPageHorizontal,
AppDimens.followingSectionBottomGap,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
l10n.favoriteDramas,
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: AppDimens.followingSectionTitleFont,
fontWeight: FontWeight.w400,
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 2),
child: Text(
l10n.totalDramasCount(controller.total),
style: const TextStyle(
color: AppColors.textTabInactive,
fontSize: AppDimens.followingSectionCountFont,
),
),
),
],
),
),
),
];
}
/// 最近一条观看记录(records 已按最近观看排序,与观看历史页首条一致)。
WatchRecord? _continueRecord() {
return history.records.isEmpty ? null : history.records.first;
}
Widget _item( Widget _item(
BuildContext context, BuildContext context,
int index, int index,
+2 -5
View File
@@ -1,4 +1,5 @@
// Author: fruit.com.cn // Author: fruit.com.cn
// 职责:追剧收藏与观看历史切换、数据刷新、管理和续播入口。
import 'dart:async'; import 'dart:async';
@@ -39,7 +40,7 @@ class FollowingPage extends StatefulWidget {
final FavoriteController favoriteController; final FavoriteController favoriteController;
final int historyRequest; final int historyRequest;
/// 当前是否为首页选中的 tab;重新可见时刷新观看历史,保证横幅是最新进度。 /// 当前是否为首页选中的 tab;重新可见时刷新观看历史,保证记录是最新进度。
final bool visible; final bool visible;
@override @override
@@ -157,7 +158,6 @@ class _FollowingPageState extends State<FollowingPage> {
FollowingKeepAliveTab( FollowingKeepAliveTab(
child: FollowingFavoritesGrid( child: FollowingFavoritesGrid(
controller: widget.favoriteController, controller: widget.favoriteController,
history: _history,
selection: FollowingFavoriteSelection( selection: FollowingFavoriteSelection(
editing: _editing, editing: _editing,
selected: _selected, selected: _selected,
@@ -165,9 +165,6 @@ class _FollowingPageState extends State<FollowingPage> {
), ),
scrollController: _favoriteScroll, scrollController: _favoriteScroll,
onGoHome: widget.onGoHome, onGoHome: widget.onGoHome,
onContinueRecord: (record) => unawaited(
_openHistory(context, _history, record),
),
), ),
), ),
FollowingKeepAliveTab( FollowingKeepAliveTab(
@@ -49,8 +49,8 @@ class ContinueWatchingBanner extends StatelessWidget {
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: [ colors: [
Color(0xCC000000), Color(0x80000000),
Color(0x99000000), Color(0x33000000),
Color(0x00000000), Color(0x00000000),
], ],
stops: [0, 0.45, 1], stops: [0, 0.45, 1],
@@ -164,9 +164,8 @@ class _HomeCategoryDramasState extends State<HomeCategoryDramas> {
hasMore: slot?.hasMore ?? false, hasMore: slot?.hasMore ?? false,
hasItems: dramas.isNotEmpty, hasItems: dramas.isNotEmpty,
errorMessage: null, errorMessage: null,
onRetry: () => context.read<CategoryController>().loadMore( onRetry: () =>
categoryId, context.read<CategoryController>().loadMore(categoryId),
),
), ),
), ),
), ),
+8 -12
View File
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import '../../../core/formatting/count_format.dart'; import '../../../core/formatting/count_format.dart';
import '../../../core/theme/app_colors.dart'; import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart'; import '../../../core/theme/app_dimens.dart';
import '../../../core/widgets/animated_nav_label.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
enum HomePrimaryTab { enum HomePrimaryTab {
@@ -323,21 +324,16 @@ class _CategoryBarState extends State<_CategoryBar> {
height: AppDimens.homePrimaryRowHeight, height: AppDimens.homePrimaryRowHeight,
child: Align( child: Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: AnimatedDefaultTextStyle( child: AnimatedNavLabel(
key: Key('home-primary-label-${category.categoryId}'), key: Key('home-primary-label-${category.categoryId}'),
duration: AppDimens.homePrimaryTabAnimationDuration, label: category.label,
curve: Curves.easeOut, selected: selected,
style: TextStyle( alignment: Alignment.bottomLeft,
color: selected style: const TextStyle(
? AppColors.navSelected color: AppColors.navSelected,
: AppColors.textTabInactive, fontSize: AppDimens.homePrimaryTabSelectedFont,
fontSize: selected
? AppDimens.homePrimaryTabSelectedFont
: AppDimens.homePrimaryTabFont,
fontWeight: selected ? FontWeight.w700 : FontWeight.w400,
letterSpacing: 0, letterSpacing: 0,
), ),
child: Text(category.label, textAlign: TextAlign.left),
), ),
), ),
), ),
+1 -1
View File
@@ -33,7 +33,7 @@ class MineAboutPage extends StatelessWidget {
), ),
children: [ children: [
Text( Text(
l10n.appName, l10n.aboutBrandName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontFamily: 'Outfit', fontFamily: 'Outfit',
+96 -95
View File
@@ -31,8 +31,10 @@ import '../watch_records/watch_records_page.dart';
import 'mine_binding.dart'; import 'mine_binding.dart';
import 'mine_logic.dart'; import 'mine_logic.dart';
import 'mine_types.dart'; import 'mine_types.dart';
import 'widgets/mine_action_grid.dart';
import 'widgets/mine_header.dart'; import 'widgets/mine_header.dart';
import 'widgets/mine_menu.dart'; import 'widgets/mine_menu.dart';
import 'widgets/mine_stats_panel.dart';
/// K28-B 我的页。 /// K28-B 我的页。
class MyPage extends StatefulWidget { class MyPage extends StatefulWidget {
@@ -84,7 +86,9 @@ class _MyPageState extends State<MyPage> {
_activationRefreshScheduled = true; _activationRefreshScheduled = true;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_activationRefreshScheduled = false; _activationRefreshScheduled = false;
if (mounted) unawaited(_favorites.load()); if (!mounted) return;
unawaited(_favorites.load());
_refreshWallet(onlyIfMissing: true);
}); });
} }
@@ -96,9 +100,17 @@ class _MyPageState extends State<MyPage> {
if (!mounted || !widget.active) return; if (!mounted || !widget.active) return;
logic.syncPage(active: true, wasActive: false); logic.syncPage(active: true, wasActive: false);
unawaited(_favorites.load()); unawaited(_favorites.load());
_refreshWallet();
}); });
} }
void _refreshWallet({bool onlyIfMissing = false}) {
if (!_auth.isSignedIn) return;
final wallet = context.read<WalletController>();
if (wallet.loading || (onlyIfMissing && wallet.snapshot != null)) return;
unawaited(wallet.load());
}
void _onAuthChanged() { void _onAuthChanged() {
final signedIn = _auth.isSignedIn; final signedIn = _auth.isSignedIn;
if (signedIn == _wasSignedIn) return; if (signedIn == _wasSignedIn) return;
@@ -165,78 +177,62 @@ class _MyPageState extends State<MyPage> {
} }
Widget _body(BuildContext context) { Widget _body(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return ListView( return ListView(
key: const Key('mine-page-scroll'), key: const Key('mine-page-scroll'),
padding: const EdgeInsets.only(bottom: AppDimens.spaceXl), padding: const EdgeInsets.only(bottom: AppDimens.spaceXl),
children: [ children: [
Padding( _section(
padding: const EdgeInsets.symmetric( MineHeader(
horizontal: AppDimens.pageHorizontal,
),
child: MineHeader(
onLogin: _openLogin, onLogin: _openLogin,
onEdit: () => _push(const AccountProfilePage()), onEdit: () => _push(const AccountProfilePage()),
), ),
), ),
const SizedBox(height: AppDimens.spaceSm),
_section(_statsPanel()),
const SizedBox(height: AppDimens.spaceMd), const SizedBox(height: AppDimens.spaceMd),
Padding( _section(
padding: const EdgeInsets.symmetric( MineVipBanner(onOpen: () => _openDestination(MineDestination.vip)),
horizontal: AppDimens.pageHorizontal,
),
child: MineVipBanner(
onOpen: () => _openDestination(MineDestination.vip),
),
),
const SizedBox(height: AppDimens.mineSectionGap),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppDimens.pageHorizontal,
),
child: MineQuickActions(
onWallet: () => _openDestination(MineDestination.wallet),
onFavorites: () => _push(const FavoritesPage()),
onDownloads: () => _openDestination(MineDestination.downloads),
onHistory: () => _openDestination(MineDestination.history),
),
), ),
const SizedBox(height: AppDimens.mineSectionGap), const SizedBox(height: AppDimens.mineSectionGap),
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: AppDimens.mineGridHorizontal, horizontal: AppDimens.mineGridHorizontal,
), ),
child: Column( child: MineActionGrid(
crossAxisAlignment: CrossAxisAlignment.start, primaryActions: MinePrimaryActions(
children: [ onWallet: () => _openDestination(MineDestination.wallet),
Text( onFavorites: () => unawaited(_openFavoritesPage()),
l10n.moreServices, onDownloads: () => _openDestination(MineDestination.downloads),
style: const TextStyle( onHistory: () => _openDestination(MineDestination.history),
color: AppColors.textTertiary, ),
fontSize: AppDimens.mineSectionTitle, serviceActions: MineServiceActions(
), onOpen: _openDestination,
), onLanguage: _openLanguage,
const SizedBox(height: AppDimens.spaceSm), ),
MineServiceList(
onOpen: _openDestination,
onLanguage: _openLanguage,
languageName: _languageName(context),
),
],
), ),
), ),
], ],
); );
} }
/// 语言设置行右侧展示的当前语言名。 Widget _section(Widget child) {
String _languageName(BuildContext context) { return Padding(
final l10n = AppLocalizations.of(context)!; padding: const EdgeInsets.symmetric(horizontal: AppDimens.pageHorizontal),
final code = context.read<LocaleController>().locale?.languageCode; child: child,
return switch (code) { );
'en' => l10n.english, }
'id' => l10n.bahasaIndonesia,
_ => l10n.simplifiedChinese, Widget _statsPanel() {
}; return MineStatsSection(
watchRecordCount: logic.recentError == null
? logic.watchRecordTotal
: null,
actions: MineStatsActions(
onWallet: () => _openDestination(MineDestination.wallet),
onHistory: () => _openDestination(MineDestination.history),
onFavorites: () => unawaited(_openFavoritesPage()),
),
);
} }
void _openDestination(MineDestination destination) { void _openDestination(MineDestination destination) {
@@ -269,6 +265,11 @@ class _MyPageState extends State<MyPage> {
if (mounted) unawaited(logic.refreshRecent()); if (mounted) unawaited(logic.refreshRecent());
} }
Future<void> _openFavoritesPage() async {
await _push(const FavoritesPage());
if (mounted) unawaited(_favorites.load());
}
Future<void> _push(Widget page) { Future<void> _push(Widget page) {
return Navigator.of( return Navigator.of(
context, context,
@@ -373,56 +374,56 @@ class _LanguageSheet extends StatelessWidget {
type: MaterialType.transparency, type: MaterialType.transparency,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: SafeArea( child: SafeArea(
top: false, top: false,
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(20, 14, 20, 20), padding: const EdgeInsets.fromLTRB(20, 14, 20, 20),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
l10n.language, l10n.language,
style: const TextStyle( style: const TextStyle(
color: AppColors.textPrimary, color: AppColors.textPrimary,
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
),
), ),
), ),
), IconButton(
IconButton( tooltip: l10n.close,
tooltip: l10n.close, onPressed: () => Navigator.pop(context),
onPressed: () => Navigator.pop(context), visualDensity: VisualDensity.compact,
visualDensity: VisualDensity.compact, padding: EdgeInsets.zero,
padding: EdgeInsets.zero, constraints: const BoxConstraints(
constraints: const BoxConstraints( minWidth: 32,
minWidth: 32, minHeight: 32,
minHeight: 32, ),
icon: const Icon(Icons.close_rounded, size: 20),
), ),
icon: const Icon(Icons.close_rounded, size: 20), ],
),
],
),
for (final option in options)
ListTile(
key: option.$2,
contentPadding: const EdgeInsets.symmetric(horizontal: 4),
title: Text(option.$3),
trailing: selected?.languageCode == option.$1.languageCode
? const Icon(
Icons.check_rounded,
color: AppColors.textPrimary,
)
: null,
onTap: () => Navigator.pop(context, option.$1),
), ),
], for (final option in options)
ListTile(
key: option.$2,
contentPadding: const EdgeInsets.symmetric(horizontal: 4),
title: Text(option.$3),
trailing: selected?.languageCode == option.$1.languageCode
? const Icon(
Icons.check_rounded,
color: AppColors.textPrimary,
)
: null,
onTap: () => Navigator.pop(context, option.$1),
),
],
),
), ),
), ),
), ),
),
); );
} }
} }
@@ -0,0 +1,270 @@
// Author: fruit.com.cn
import 'package:flutter/material.dart';
import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart';
import '../../../l10n/app_localizations.dart';
import '../mine_types.dart';
const int _gridColumnCount = 4;
const double _gridMaxTextScale = 1.2;
/// 「我的」页统一操作宫格:常用入口与服务入口按 4×2 排列。
class MineActionGrid extends StatelessWidget {
const MineActionGrid({
super.key,
required this.primaryActions,
required this.serviceActions,
});
final MinePrimaryActions primaryActions;
final MineServiceActions serviceActions;
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final items = [..._primaryItems(l10n), ..._serviceItems(l10n)];
return SizedBox(
height: AppDimens.mineGridHeight,
child: DecoratedBox(
key: const Key('mine-menu'),
decoration: BoxDecoration(
color: AppColors.mineGridSurface,
border: Border.all(color: AppColors.contentBorder),
borderRadius: BorderRadius.circular(AppDimens.mineGridRadius),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(AppDimens.mineGridRadius),
child: MediaQuery.withClampedTextScaling(
maxScaleFactor: _gridMaxTextScale,
child: Column(
children: [
_row(items.take(_gridColumnCount).toList()),
const _MineHorizontalDivider(),
_row(items.skip(_gridColumnCount).toList()),
],
),
),
),
),
);
}
List<_MineActionItem> _primaryItems(AppLocalizations l10n) {
return [
_MineActionItem(
key: const Key('mine-wallet'),
icon: Icons.account_balance_wallet_outlined,
label: l10n.wallet,
onTap: primaryActions.onWallet,
),
_MineActionItem(
key: const Key('mine-favorites'),
icon: Icons.star_outline_rounded,
label: l10n.myFavorites,
onTap: primaryActions.onFavorites,
),
_MineActionItem(
key: const Key('mine-downloads'),
icon: Icons.download_for_offline_outlined,
label: l10n.offlineDownloads,
onTap: primaryActions.onDownloads,
),
_MineActionItem(
key: const Key('mine-history'),
icon: Icons.history_rounded,
label: l10n.watchHistory,
onTap: primaryActions.onHistory,
),
];
}
List<_MineActionItem> _serviceItems(AppLocalizations l10n) {
return [
_MineActionItem(
key: const Key('mine-help'),
icon: Icons.support_agent_outlined,
label: l10n.contactSupport,
onTap: () => serviceActions.onOpen(MineDestination.help),
),
_MineActionItem(
key: const Key('mine-language'),
icon: Icons.language_rounded,
label: l10n.language,
onTap: serviceActions.onLanguage,
),
_MineActionItem(
key: const Key('mine-settings'),
icon: Icons.settings_outlined,
label: l10n.settings,
onTap: () => serviceActions.onOpen(MineDestination.settings),
),
_MineActionItem(
key: const Key('mine-notices'),
icon: Icons.notifications_none_rounded,
label: l10n.notices,
onTap: () => serviceActions.onOpen(MineDestination.notices),
),
];
}
Widget _row(List<_MineActionItem> items) {
return SizedBox(
height: AppDimens.mineGridCellHeight,
child: Row(
children: [
for (var index = 0; index < items.length; index++) ...[
Expanded(child: _MineActionCell(item: items[index])),
if (index < items.length - 1) const _MineVerticalDivider(),
],
],
),
);
}
}
/// 宫格第一排的常用功能回调。
class MinePrimaryActions {
const MinePrimaryActions({
required this.onWallet,
required this.onFavorites,
required this.onDownloads,
required this.onHistory,
});
final VoidCallback onWallet;
final VoidCallback onFavorites;
final VoidCallback onDownloads;
final VoidCallback onHistory;
}
/// 宫格第二排的服务功能回调。
class MineServiceActions {
const MineServiceActions({required this.onOpen, required this.onLanguage});
final ValueChanged<MineDestination> onOpen;
final VoidCallback onLanguage;
}
class _MineActionItem {
const _MineActionItem({
required this.key,
required this.icon,
required this.label,
required this.onTap,
});
final Key key;
final IconData icon;
final String label;
final VoidCallback onTap;
Key get iconSurfaceKey =>
ValueKey('${(key as ValueKey<String>).value}-icon-surface');
}
class _MineActionCell extends StatelessWidget {
const _MineActionCell({required this.item});
final _MineActionItem item;
@override
Widget build(BuildContext context) {
return Material(
color: AppColors.transparent,
child: InkWell(
key: item.key,
onTap: item.onTap,
child: Semantics(
button: true,
label: item.label,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_iconSurface(),
const SizedBox(height: AppDimens.spaceSm),
_label(),
],
),
),
),
);
}
Widget _iconSurface() {
return Container(
key: item.iconSurfaceKey,
width: AppDimens.mineGridIconSurface,
height: AppDimens.mineGridIconSurface,
decoration: BoxDecoration(
gradient: const RadialGradient(
center: Alignment(-0.35, -0.45),
radius: 0.95,
colors: [
AppColors.mineOutline,
AppColors.contentChip,
AppColors.mineGridIconSurface,
],
),
shape: BoxShape.circle,
border: Border.all(color: AppColors.glassBorder),
boxShadow: [
const BoxShadow(
color: AppColors.shadowSoft,
blurRadius: AppDimens.spaceSm,
offset: Offset(0, AppDimens.spaceXs),
),
BoxShadow(
color: AppColors.brandRed.withValues(alpha: 0.12),
blurRadius: AppDimens.spaceSm,
),
],
),
child: Icon(
item.icon,
color: AppColors.mineGridIconAccent,
size: AppDimens.mineGridIcon,
),
);
}
Widget _label() {
return Text(
item.label,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: const TextStyle(
color: AppColors.mineGridLabel,
fontSize: AppDimens.mineGridLabel,
fontWeight: FontWeight.w500,
height: AppDimens.mineGridLabelLineHeight,
),
);
}
}
class _MineVerticalDivider extends StatelessWidget {
const _MineVerticalDivider();
@override
Widget build(BuildContext context) {
return Container(
width: AppDimens.mineGridHairline,
color: AppColors.mineGridDivider,
);
}
}
class _MineHorizontalDivider extends StatelessWidget {
const _MineHorizontalDivider();
@override
Widget build(BuildContext context) {
return Container(
height: AppDimens.mineGridHairline,
color: AppColors.mineGridDivider,
);
}
}
Loaded 100 of 166 files, more files were not shown because too many files have changed in this diff. Show more