Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67e178c89d | ||
|
|
8481611372 | ||
|
|
b1e95b370c | ||
|
|
0ef0d46919 | ||
|
|
b4d38f8e10 | ||
|
|
c034627fdb | ||
|
|
ef29fc5f15 | ||
|
|
671e0ce143 | ||
|
|
0f1f64a09f | ||
|
|
d29ae20491 | ||
|
|
12e08a89a4 | ||
|
|
e0ba54f23b | ||
|
|
5043d6c25b | ||
|
|
ab6800aba2 | ||
|
|
f8500bbaca | ||
|
|
9b1afbdb36 | ||
|
|
f4cf7bc2dd | ||
|
|
60489d6dca | ||
|
|
44d3bcba18 | ||
|
|
f206977ad8 | ||
|
|
f3d64f6fb5 | ||
|
|
6318ca24ec | ||
|
|
b513ac0a9c | ||
|
|
25d90e1383 | ||
|
|
7804809d83 | ||
|
|
5f278a3510 | ||
|
|
56d7abc6b1 | ||
|
|
345cc2ad28 | ||
|
|
41bd4683c3 | ||
|
|
d868ce9336 | ||
|
|
928ac1de19 | ||
|
|
6b3d870c93 | ||
|
|
281f13a810 | ||
|
|
8637f5da21 | ||
|
|
0319f8a6a8 | ||
|
|
9aa797504b | ||
|
|
933333b0fe | ||
|
|
bbc759473c | ||
|
|
9ddd7fc833 | ||
|
|
5794dd4e4d | ||
|
|
76c4b528d3 | ||
|
|
68ccfa21c0 | ||
|
|
78d0166eb7 | ||
|
|
4140c4eb50 | ||
|
|
e2cc409e5a | ||
|
|
9b83283689 | ||
|
|
db8433ace3 | ||
|
|
6f1da5aa39 | ||
|
|
397483d339 | ||
|
|
37e35f4b47 | ||
|
|
86aa7e0f4f | ||
|
|
604ab60b63 | ||
|
|
0b3f362093 | ||
|
|
19acbb2278 | ||
|
|
ce3ecc4d21 | ||
|
|
c604cc1333 | ||
|
|
e7367e99be | ||
|
|
9953c955e3 | ||
|
|
7971ac18fc | ||
|
|
a81bec4d47 | ||
|
|
647f6afd77 | ||
|
|
9785a1baf3 | ||
|
|
e70ca03c03 | ||
|
|
95fb2ff882 | ||
|
|
b6e5f808d6 | ||
|
|
3f3dc9263c | ||
|
|
f67b8bd514 | ||
|
|
4d304cb549 | ||
|
|
201d58e8f4 | ||
|
|
091ea358bd | ||
|
|
af828d2c46 | ||
|
|
c14d89ffce | ||
|
|
b185200e8c | ||
|
|
2fac46f248 | ||
|
|
cffb68809c | ||
|
|
13d70fcef2 | ||
|
|
bf20e44b85 | ||
|
|
9cf1efc316 | ||
|
|
3655d94869 | ||
|
|
196ce69a12 | ||
|
|
c7a0e277f2 | ||
|
|
57c9e6b477 | ||
|
|
64bc1997ba | ||
|
|
21bb716af4 | ||
|
|
a40adbb99a | ||
|
|
d79e200650 | ||
|
|
3b9ff8a306 | ||
|
|
af4d918938 | ||
|
|
3289012f64 | ||
|
|
e147002e00 | ||
|
|
099d05064e | ||
|
|
4eb411ef28 | ||
|
|
14885d9efa | ||
|
|
17faa749b2 | ||
|
|
5fce65ac57 | ||
|
|
357492acb2 | ||
|
|
23799353b5 | ||
|
|
cf6d12b7c8 | ||
|
|
5af6caea6e | ||
|
|
d66ff13d0f | ||
|
|
7599da1d40 | ||
|
|
04f1f5a73f | ||
|
|
f5721592f7 | ||
|
|
5abee5f69a | ||
|
|
3690fb1bc4 | ||
|
|
2765343340 | ||
|
|
afe7a49ef0 | ||
|
|
b6666290ba | ||
|
|
a1c0af3f00 | ||
|
|
b5bfc1d7b2 | ||
|
|
1d2ba93e48 | ||
|
|
c08df9af40 | ||
|
|
be166f5856 | ||
|
|
e531c78997 | ||
|
|
8ed6cd9fd6 | ||
|
|
c1d55b91a2 | ||
|
|
3dcfa02372 | ||
|
|
b6826f7483 | ||
|
|
cd3d84cf9a | ||
|
|
010ce326ea | ||
|
|
2577797772 | ||
|
|
05e2952815 | ||
|
|
6ae9e8e043 | ||
|
|
182b7e3ac2 | ||
|
|
8bb365db2a | ||
|
|
0cb57d084d | ||
|
|
5c174b007c | ||
|
|
35364c949a | ||
|
|
814b2c0b7b | ||
|
|
3d0e0804ca |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission
|
||||
android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="FruitShorts"
|
||||
android:name="${applicationName}"
|
||||
@@ -23,9 +23,8 @@
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
@@ -35,7 +34,7 @@
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
android:value="2"/>
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
@@ -44,8 +43,10 @@
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
<action
|
||||
android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data
|
||||
android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
@@ -36,6 +36,9 @@ class MainActivity : FlutterActivity() {
|
||||
private var imeInset = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
splashScreen.setOnExitAnimationListener { screen -> screen.remove() }
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
@@ -1,4 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_screen" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 43 KiB |
@@ -1,4 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_screen" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 69 B After Width: | Height: | Size: 69 B |
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_screen" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_screen" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 69 B After Width: | Height: | Size: 69 B |
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_screen" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_launcher_foreground"
|
||||
android:inset="16%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 6.3 KiB |
@@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:windowSplashScreenBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
|
||||
<item name="android:forceDarkAllowed">false</item>
|
||||
<item name="android:windowFullscreen">false</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowSplashScreenBackground">#000000</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_brand</item>
|
||||
<item name="android:windowSplashScreenAnimationDuration">0</item>
|
||||
</style>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:windowSplashScreenBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
|
||||
<item name="android:forceDarkAllowed">false</item>
|
||||
<item name="android:windowFullscreen">false</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowSplashScreenBackground">#000000</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_brand</item>
|
||||
<item name="android:windowSplashScreenAnimationDuration">0</item>
|
||||
</style>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<resources>
|
||||
<color name="splash_background">#1F1B16</color>
|
||||
</resources>
|
||||
<color name="splash_background">#000000</color>
|
||||
<color name="ic_launcher_background">#FF6B2C</color>
|
||||
</resources>
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 42 KiB |
@@ -1183,6 +1183,139 @@ $ flutter test
|
||||
- 按最新反馈移除整行榜单与热度胶囊,信息顺序收敛为标题、剧名、标签、简介、观看全集。
|
||||
- 剧名 19/w600,箭头 20 白色并紧邻剧名;标签行改为 13/w600 亮灰内联布局。
|
||||
- 简介「展开/收起」沿用现有三语文案;进度条热区恢复 24 并接入拖动自动清屏与预览卡片。
|
||||
- 拖动期间隐藏操作栏、文字及根底栏,顶部导航常驻;松手后持续清屏直到点击画面。
|
||||
- 进度条固定中心并动画到 6 高,时间气泡限制在左右 12;按当前流程未执行 analyze/test。
|
||||
- 拖动仅控制视频浮层内容,顶部导航与根底栏保持常驻。
|
||||
- 进度条固定中心并动画到 6 高,命中高度 32,时间气泡限制在左右 12;end/cancel/pointer 兜底均恢复拖动前状态。
|
||||
- 修复 `scrubCancelRequest` 误置于 `initState` 的编译错误,并清理推荐页未使用变量;`flutter analyze` 无问题。
|
||||
- 观看全集按钮相对进度条上移 8,间距调整为 20;按钮改为屏幕宽度 70% 左对齐,`flutter analyze` 无问题。
|
||||
|
||||
## 2026-10-22 进度条按下与拖动彻底修复
|
||||
|
||||
- Slider 不再在 `onChangeStart` 清屏;首次真实移动后才进入 scrub,轨道 2/6、thumb 6/8。
|
||||
- 推荐流拖动使用独立 opaque 手势与 pointer 兜底,end/cancel 同时恢复浮层和轨道。
|
||||
- 推荐浮层改为 AnimatedOpacity + IgnorePointer,进度条节点始终留在树中;scrub setState 均加 mounted 守卫。
|
||||
- `flutter test test/player/seek_scrub_visibility_test.dart`:6 项测试全部通过。
|
||||
|
||||
## 2026-10-22 推荐页播放跳转修正
|
||||
|
||||
- 标题、剧名行和观看全集统一通过 `playDramaFromCatalog` 打开非 `homeMode` 逐集播放页。
|
||||
- 仅含集数的剧集标题不再显示在标题上方,集数只保留下方进度文案。
|
||||
- `flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 推荐页横向切换
|
||||
|
||||
- 推荐、剧单、全部短剧改为共享 PageController 的横向 PageView,点击与滑动均驱动同一选中态。
|
||||
- 三页使用 AutomaticKeepAliveClientMixin 保留视频、滚动位置和筛选状态;顶部导航固定在外层。
|
||||
- `flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 全部短剧布局重排
|
||||
|
||||
- 四行筛选统一 28 高、8 行距、24 项目间距;选中 chip 改为 `#4A1E1E`、白字 13/w600、圆角 14。
|
||||
- 最热/最新改为纯文字选中态,三横线筛选固定在右端;网格改为左右 12、列距 6、行距 12。
|
||||
- 第三行筛选完整展示,卡片继续复用首页组件;`flutter analyze`:No issues found。
|
||||
- 筛选项字号提升到 15、圆角 15;筛选区移出滚动容器并固定吸顶,下拉刷新仅作用于网格。
|
||||
- 四行首项文字统一到同一 x;行高 30、行距 6、项目距 12,第 4 行保持弹性空白后固定筛选图标。
|
||||
- 按最新截图改为 16sp、32 高、10 行距、16 项距;选中态为 `#21090E` 底配 `#FF4D6A` 粉字。
|
||||
- 第 4 行复用选中胶囊样式,右侧改为 44×44 圆形深灰按钮和 22 三横线图标;`flutter analyze` 无问题。
|
||||
- 筛选行距收紧到 6、项距 10,chip 左右 padding 12;四行均可横向回弹滑动。
|
||||
- 第 4 行仅最热/最新在滚动区内,44 圆形筛选按钮固定在滚动区外;`flutter analyze` 无问题。
|
||||
- 四行统一复用 `_filterRow` 构建,筛选区仅保留一层左右 12 padding。
|
||||
- 新增量化测试断言四行首项 x 均为 12、相邻 chip 间距均为 10;`flutter analyze` 无问题。
|
||||
- 修复横向 viewport 对短内容居中:滚动内容最小宽度撑满视口后由 Row.start 排列。
|
||||
- `flutter test test/recommend/all_dramas_filter_alignment_test.dart`:1 项测试通过。
|
||||
|
||||
## 2026-10-22 首页二级标签移除筛选按钮
|
||||
|
||||
- 首页二级标签行改为纯横向滑动,右侧三横线按钮不渲染也不占位。
|
||||
- 删除不再使用的筛选回调、尺寸 token、颜色和 CustomPainter;全部短剧页筛选按钮保持不变。
|
||||
- `flutter analyze`:No issues found。
|
||||
- 按后续更正恢复首页透明三横线按钮(26、无背景、`#7A7A7E`),删除全部短剧第 4 行圆形按钮及回调链路。
|
||||
|
||||
## 2026-10-22 追剧页三列改造
|
||||
|
||||
- 追剧页移除预约 tab,改为追剧/播放历史双页横向切换,并保留各自滚动位置。
|
||||
- 追剧与历史统一三列卡片,新增固定加号卡片,历史进度与编辑删除能力保留。
|
||||
- 按最新口径调整列距 6、行距 12、封面圆角 6;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 播放历史单列列表
|
||||
|
||||
- 追剧保持三列网格,播放历史改为左封面右信息的单列列表,行距 16。
|
||||
- 历史卡片补充 96×128 封面、观看进度、已看百分比、继续观看和编辑删除。
|
||||
- 追剧加号卡片移到全部追剧卡片之后,空列表时仍在左上角。
|
||||
- 加号改为 `#8E8E93`、28 尺寸、1.5 描边,卡片底色与圆角不变。
|
||||
- 刷新、分页与各页独立滚动位置保持;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 追剧页切换与编辑按钮修正
|
||||
|
||||
- 追剧与历史页增加 keep-alive,tab 与编辑态改用局部 ValueNotifier 更新,切换不再重建整个页面。
|
||||
- 编辑图标调整为 20、`#B0B0B0`,热区 40×40,保持右侧 14 边距和垂直居中。
|
||||
- 列表刷新期间保留已有数据与各页滚动位置;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 播放历史继续观看按钮微调
|
||||
|
||||
- 继续观看改为无边框、无底色的纯文字按钮,默认 `#B0B0B0`、12/w500,按压态使用品牌色。
|
||||
- 保持 28 高点击热区和右侧零间距;未执行测试或 analyze。
|
||||
|
||||
## 2026-10-22 我的页渐变与图标网格
|
||||
|
||||
- 页面背景改为暖黑三段纵向渐变,用户区与 VIP 卡布局保持不变。
|
||||
- 行式入口替换为 4 列图标网格,7 个原入口按顺序保留,第 8 格为空占位。
|
||||
- 网格使用 14 边距、半透明深灰底、圆角 12 和仅内部 1px 分隔线;`flutter analyze`:No issues found。
|
||||
- 渐变增强为 `#3A1B0E`/`#1A0C07`/黑色并叠加顶部品牌橙径向光晕,同时移除页面级「我的」标题栏。
|
||||
- 7 个宫格图标分别使用金币金、天蓝、薄荷绿、粉红、紫色、青色和冷灰;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 我的页补充内容
|
||||
|
||||
- VIP 与宫格之间新增继续观看横向列表、追剧/观看记录/金币统计面板,继续观看最多 10 条。
|
||||
- 宫格后新增常见问题与关于我们入口;关于页版本暂用与 pubspec 同步的常量占位。
|
||||
- 继续观看全部入口可切到追剧页播放历史 tab;`flutter analyze`:No issues found。
|
||||
- 用户区昵称与 UID 收紧为 4 间距,昵称列相对头像垂直居中;UID 12、复制图标 14。
|
||||
- UID 行改用 GestureDetector 并锁定 16 高,昵称与 UID 间距 2、昵称行高 1.15,避免 Material 热区撑高;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 推荐剧单渐变背景
|
||||
|
||||
- 仅为推荐页「剧单」子页增加暖黑三段渐变和品牌橙径向光晕,推荐视频与全部短剧背景不变。
|
||||
- 渐变复用「我的」页色值,光晕使用 `#26FF6B2C`;分区与卡片样式保持原样;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 全站深色视觉统一
|
||||
|
||||
- 全局 token 改为纯黑页面、`#16161A` 卡片、`#1C1C1E` 描边/分割线与 B0/8E 文本层级,旧深蓝页面渐变替换为暖黑渐变。
|
||||
- 普通二级页标题栏改为透明、白色标题与返回图标;统一卡片 12 圆角、1px 描边和无阴影策略。
|
||||
- 覆盖新剧、筛选、榜单、预约、收藏、观看历史、下载、设置、钱包、VIP、通知、详情、登录、关于;播放器沉浸区保持纯黑。
|
||||
- `flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 统一下拉与加载指示器
|
||||
|
||||
- 下拉刷新统一为 40×40、60% 黑底圆角指示器内嵌 20 白色加载圈,不再显示任何状态文字。
|
||||
- 网络分页与本地分页 footer 统一仅显示白色加载圈,无更多状态完全隐藏;通知页补触底自动加载。
|
||||
- 移除不再使用的刷新提示与无更多文案;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 首页热播榜重做
|
||||
|
||||
- 首页榜单 tab 改为独立领奖台 + 单列排行布局,不再复用三列网格。
|
||||
- 前三名按 2/1/3 排列,冠军放大并上移;第 4 名起使用大号描边名次与横向信息行。
|
||||
- 榜单沿用现有播放热度排序、分页和播放逻辑;`flutter analyze`:No issues found。
|
||||
|
||||
## 2026-10-22 播放器双击点赞与飘心
|
||||
|
||||
- 沉浸式播放器改用 onTapUp + 280ms Timer 判定双击,双击取消单击,长按左右倍速与中间更多保持不变。
|
||||
- 双击和右侧心形共用点赞方法,成功后控制器通知并点亮红色实心心形,失败由 controller 回滚并使用 Toast。
|
||||
- 飘心层使用独立 IgnorePointer Stack,动画完成后自动移除;`flutter analyze`:No issues found。
|
||||
- `flutter test test/player/double_tap_like_test.dart`:2 项测试全部通过。
|
||||
- 移除视频表面点击识别器,双击后增加 300ms 暂停防护;飘心收敛为 3~4 颗、20~26、±18、90~120dp、600~700ms。
|
||||
- 双击窗口延长至 320ms,单击 Timer 使用点击序号校验,双击后保留 350ms 播放切换保护。
|
||||
- `double_tap_like_test.dart` 覆盖 120/250/300ms 双击与 500ms 单击恢复:2 项测试全部通过。
|
||||
|
||||
## 2026-10-22 统一二级搜索页
|
||||
|
||||
- 首页与推荐/剧单/全部短剧搜索入口统一 push SearchPage,不再切换推荐 tab 聚焦。
|
||||
- 搜索页提供返回、自动聚焦输入框与取消,复用 `/app/search` 逻辑和首页三列卡片。
|
||||
- 清理旧的 searchRequest/focusSearch/syncSearch 参数;`flutter analyze`:No issues found。
|
||||
- 搜索页结果改为独立两列卡片,左右 14、列距 12、行距 16,并移除 HomeFeedCard 复用。
|
||||
- 搜索结果支持下拉刷新:保留旧结果按当前关键词重取第一页,空关键词直接回弹且不改变焦点。
|
||||
|
||||
## 2026-10-22 App 图标与开屏更新
|
||||
|
||||
- Launcher/Android 12 启动背景统一纯黑,自适应图标背景改为品牌橙。
|
||||
- Android/iOS 图标与启动资源已重新生成;应用内开屏固定 splash_logo,宽 200 等比居中。
|
||||
- `flutter analyze`:No issues found。
|
||||
- 移除 Flutter 内 `_startupSplash` 与 `startup-splash`,只保留系统原生开屏;最新斜体字标素材已重新生成。
|
||||
@@ -2,6 +2,8 @@ import Flutter
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
|
||||
private let thumbnailHTTPHeaderFieldsKey = "AVURLAssetHTTPHeaderFieldsKey"
|
||||
|
||||
private final class ThumbnailResponseGate {
|
||||
private let lock = NSLock()
|
||||
private var completed = false
|
||||
@@ -29,7 +31,7 @@ final class RunnerFlutterViewController: FlutterViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
view.backgroundColor = UIColor(red: 16.0 / 255.0, green: 12.0 / 255.0, blue: 10.0 / 255.0, alpha: 1)
|
||||
view.backgroundColor = .black
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ final class RunnerFlutterViewController: FlutterViewController {
|
||||
|
||||
let options: [String: Any]? = headers.isEmpty
|
||||
? nil
|
||||
: [AVURLAssetHTTPHeaderFieldsKey: headers]
|
||||
: [thumbnailHTTPHeaderFieldsKey: headers]
|
||||
let asset = AVURLAsset(url: assetUrl, options: options)
|
||||
let generator = AVAssetImageGenerator(asset: asset)
|
||||
generator.appliesPreferredTrackTransform = true
|
||||
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 69 B After Width: | Height: | Size: 69 B |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 24 KiB |
@@ -16,18 +16,13 @@
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" image="LaunchBackground" translatesAutoresizingMaskIntoConstraints="NO" id="tWc-Dq-wcI"/>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"></imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"/>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="backgroundColor" red="0" green="0" blue="0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="3T2-ad-Qdv"/>
|
||||
<constraint firstItem="tWc-Dq-wcI" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="RPx-PI-7Xg"/>
|
||||
<constraint firstItem="tWc-Dq-wcI" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="SdS-ul-q2q"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tWc-Dq-wcI" secondAttribute="trailing" id="Swv-Gf-Rwn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="TQA-XW-tRk"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="duK-uY-Gun"/>
|
||||
<constraint firstItem="tWc-Dq-wcI" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="kV7-tw-vXt"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xPn-NY-SIU"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -38,7 +33,6 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="1152" height="1152"/>
|
||||
<image name="LaunchBackground" width="1" height="1"/>
|
||||
<image name="LaunchImage" width="390" height="844"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -1,109 +1,111 @@
|
||||
<?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">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</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/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<key>CFBundleDevelopmentRegion</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/>
|
||||
<key>NSExceptionDomains</key>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>127.0.0.1</key>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>192.168.31.187</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>39.162.50.99</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>开发阶段需要访问同一局域网内的短剧内容服务。</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UISceneConfigurations</key>
|
||||
<dict>
|
||||
<key>UIWindowSceneSessionRoleApplication</key>
|
||||
<array>
|
||||
<key>127.0.0.1</key>
|
||||
<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>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>10.43.47.1</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>39.162.50.99</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
</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>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>
|
||||
<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>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -14,7 +14,7 @@ class AppConfig {
|
||||
/// 开发调试默认服务地址,当前指向本机局域网 IP。
|
||||
///
|
||||
/// 换网络时只改这一行,地址不要带结尾斜杠。
|
||||
static const String devHostBaseUrl = 'http://192.168.31.187:8081';
|
||||
static const String devHostBaseUrl = 'http://10.43.47.1:8081';
|
||||
|
||||
/// 本机后端地址:通过 `adb reverse tcp:8081 tcp:8081` 映射到开发机,
|
||||
/// 探测可达时 App 直连本机服务;不可达时回落到公网地址。
|
||||
|
||||
@@ -14,6 +14,7 @@ class PlayTicket {
|
||||
this.unlockCoin = 0,
|
||||
this.previewSeconds = 0,
|
||||
this.qualities = const [],
|
||||
this.tracks = const [],
|
||||
this.thumbnailsUrl,
|
||||
this.likeCount,
|
||||
this.commentCount,
|
||||
@@ -39,8 +40,11 @@ class PlayTicket {
|
||||
/// 试看秒数:仅 `COIN_REQUIRED` 时有意义(付费解锁在 B2 做)。
|
||||
final int previewSeconds;
|
||||
|
||||
/// 后端下发的清晰度档位(如 AUTO / 720P / 1080P),HLS 由播放器自动切换。
|
||||
/// 后端下发的清晰度档位(如 AUTO / 720p / 1080p)。
|
||||
final List<String> qualities;
|
||||
|
||||
/// 各档签名地址。AUTO 是主列表,点选其它档位时换成对应地址。
|
||||
final List<PlayQualityTrack> tracks;
|
||||
final String? thumbnailsUrl;
|
||||
final int? likeCount;
|
||||
final int? commentCount;
|
||||
@@ -64,6 +68,7 @@ class PlayTicket {
|
||||
.whereType<String>()
|
||||
.where((quality) => quality.isNotEmpty)
|
||||
.toList(),
|
||||
tracks: _tracks(json['tracks'], json['playUrl'] as String? ?? ''),
|
||||
thumbnailsUrl: _optionalString(json['thumbnailsUrl']),
|
||||
likeCount: json['likeCount'] == null
|
||||
? null
|
||||
@@ -75,6 +80,67 @@ class PlayTicket {
|
||||
}
|
||||
}
|
||||
|
||||
List<PlayQualityTrack> _tracks(dynamic raw, String playUrl) {
|
||||
final tracks = <PlayQualityTrack>[];
|
||||
if (raw is List) {
|
||||
for (final item in raw) {
|
||||
if (item is! Map) continue;
|
||||
final quality = item['quality'] as String? ?? '';
|
||||
final url = item['playUrl'] as String? ?? '';
|
||||
if (quality.isEmpty || url.isEmpty) continue;
|
||||
tracks.add(PlayQualityTrack(quality: quality, playUrl: url));
|
||||
}
|
||||
}
|
||||
if (tracks.isEmpty && playUrl.isNotEmpty) {
|
||||
tracks.add(PlayQualityTrack(quality: 'AUTO', playUrl: playUrl));
|
||||
}
|
||||
return tracks;
|
||||
}
|
||||
|
||||
/// 按票据里的分轨地址取播放地址;没有分轨时,从主列表路径推出同目录的单档地址。
|
||||
String? qualityPlayUrl({
|
||||
required String quality,
|
||||
required List<PlayQualityTrack> tracks,
|
||||
required String currentUrl,
|
||||
}) {
|
||||
final wanted = quality.toUpperCase();
|
||||
for (final track in tracks) {
|
||||
if (track.quality.toUpperCase() == wanted && track.playUrl.isNotEmpty) {
|
||||
return track.playUrl;
|
||||
}
|
||||
}
|
||||
return siblingRenditionUrl(currentUrl, wanted);
|
||||
}
|
||||
|
||||
/// `.../master.m3u8` 与 `.../720p/index.m3u8` 互相换算,查询参数原样保留。
|
||||
String? siblingRenditionUrl(String currentUrl, String quality) {
|
||||
final uri = Uri.tryParse(currentUrl);
|
||||
if (uri == null || uri.path.isEmpty) return null;
|
||||
final path = uri.path;
|
||||
const masterSuffix = '/master.m3u8';
|
||||
String? root;
|
||||
if (path.endsWith(masterSuffix)) {
|
||||
root = path.substring(0, path.length - masterSuffix.length);
|
||||
} else {
|
||||
final match = RegExp(r'/(\d+p)/index\.m3u8$').firstMatch(path);
|
||||
if (match == null) return null;
|
||||
root = path.substring(0, match.start);
|
||||
}
|
||||
final next = quality.toUpperCase() == 'AUTO'
|
||||
? '$root$masterSuffix'
|
||||
: '$root/${quality.toLowerCase()}/index.m3u8';
|
||||
if (next == path) return currentUrl;
|
||||
return uri.replace(path: next).toString();
|
||||
}
|
||||
|
||||
/// 一档清晰度的签名播放地址。
|
||||
class PlayQualityTrack {
|
||||
const PlayQualityTrack({required this.quality, required this.playUrl});
|
||||
|
||||
final String quality;
|
||||
final String playUrl;
|
||||
}
|
||||
|
||||
String? _optionalString(dynamic value) {
|
||||
final text = value is String ? value.trim() : '';
|
||||
return text.isEmpty ? null : text;
|
||||
|
||||
@@ -18,6 +18,7 @@ class WatchProgress {
|
||||
this.totalEpisodes,
|
||||
this.finished = false,
|
||||
this.playCount = 0,
|
||||
this.viewCount,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
@@ -31,6 +32,9 @@ class WatchProgress {
|
||||
final Duration duration;
|
||||
final bool finished;
|
||||
final int playCount;
|
||||
|
||||
/// 短剧热度。历史列表没下发时为空,不能拿用户自己的 playCount 冒充。
|
||||
final int? viewCount;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
bool get hasPosition => position > Duration.zero;
|
||||
@@ -57,6 +61,9 @@ class WatchProgress {
|
||||
duration: Duration(milliseconds: jsonToInt(json['durationMs'])),
|
||||
finished: json['finished'] == true,
|
||||
playCount: jsonToInt(json['playCount']),
|
||||
viewCount: json['viewCount'] == null
|
||||
? null
|
||||
: jsonToInt(json['viewCount']),
|
||||
updatedAt: DateTime.tryParse(json['updatedAt'] as String? ?? ''),
|
||||
);
|
||||
}
|
||||
@@ -72,6 +79,7 @@ class WatchProgress {
|
||||
'durationMs': duration.inMilliseconds,
|
||||
'finished': finished,
|
||||
'playCount': playCount,
|
||||
if (viewCount != null) 'viewCount': viewCount,
|
||||
if (updatedAt != null) 'updatedAt': updatedAt!.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ class ApiClient {
|
||||
skipAuthRetry: skipAuthRetry,
|
||||
);
|
||||
}
|
||||
onUnauthorized?.call();
|
||||
final token = accessTokenReader?.call();
|
||||
if (token == null || token.isEmpty) onUnauthorized?.call();
|
||||
throw ApiException(401, cause.message ?? '登录已过期');
|
||||
}
|
||||
if (cause is ApiException) {
|
||||
|
||||
@@ -33,6 +33,7 @@ class AuthApi {
|
||||
required String code,
|
||||
required String deviceId,
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
String appVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
@@ -43,6 +44,7 @@ class AuthApi {
|
||||
'code': code,
|
||||
'deviceId': deviceId,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
'appVersion': appVersion,
|
||||
},
|
||||
);
|
||||
@@ -55,6 +57,7 @@ class AuthApi {
|
||||
required String code,
|
||||
required String deviceId,
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
String appVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
@@ -65,6 +68,7 @@ class AuthApi {
|
||||
'code': code,
|
||||
'deviceId': deviceId,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
'appVersion': appVersion,
|
||||
},
|
||||
);
|
||||
@@ -76,6 +80,7 @@ class AuthApi {
|
||||
required String password,
|
||||
required String deviceId,
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
String appVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
@@ -87,6 +92,7 @@ class AuthApi {
|
||||
'countryCode': 'ID',
|
||||
'deviceId': deviceId,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
'appVersion': appVersion,
|
||||
},
|
||||
);
|
||||
@@ -98,6 +104,7 @@ class AuthApi {
|
||||
required String password,
|
||||
required String deviceId,
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
String appVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
@@ -108,18 +115,25 @@ class AuthApi {
|
||||
'password': password,
|
||||
'deviceId': deviceId,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
'appVersion': appVersion,
|
||||
},
|
||||
);
|
||||
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
|
||||
}
|
||||
|
||||
Future<AuthSession> refresh(String refreshToken) async {
|
||||
Future<AuthSession> refresh(
|
||||
String refreshToken, {
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
'/app/auth/refresh',
|
||||
body: {'refreshToken': refreshToken},
|
||||
// 刷新请求本身不带旧令牌重试,失败就是失败
|
||||
skipAuthRetry: true,
|
||||
body: {
|
||||
'refreshToken': refreshToken,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
},
|
||||
);
|
||||
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
|
||||
}
|
||||
|
||||
@@ -36,4 +36,9 @@ class LibraryApi {
|
||||
Future<void> removeFavorite(String dramaId) async {
|
||||
await _client.delete('/app/favorites/$dramaId');
|
||||
}
|
||||
|
||||
/// 一次取消多部短剧,请求体为 dramaIds 数组。
|
||||
Future<void> removeFavorites(List<String> dramaIds) async {
|
||||
await _client.post('/app/favorites/remove', body: {'dramaIds': dramaIds});
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,9 @@ abstract interface class FavoriteRepository {
|
||||
Future<PageResult<Drama>> page({int pageIndex = 1, int pageSize = 20});
|
||||
|
||||
Future<void> remove(String dramaId);
|
||||
|
||||
/// 一次取消多部短剧。
|
||||
Future<void> removeMany(List<String> dramaIds);
|
||||
}
|
||||
|
||||
class HttpFavoriteRepository implements FavoriteRepository {
|
||||
@@ -36,6 +39,10 @@ class HttpFavoriteRepository implements FavoriteRepository {
|
||||
|
||||
@override
|
||||
Future<void> remove(String dramaId) => _api.removeFavorite(dramaId);
|
||||
|
||||
@override
|
||||
Future<void> removeMany(List<String> dramaIds) =>
|
||||
_api.removeFavorites(dramaIds);
|
||||
}
|
||||
|
||||
/// 内存实现:单测与 widget 测试注入用。
|
||||
@@ -51,6 +58,7 @@ class InMemoryFavoriteRepository implements FavoriteRepository {
|
||||
bool failRemove = false;
|
||||
int toggleCalls = 0;
|
||||
int pageCalls = 0;
|
||||
int removeManyCalls = 0;
|
||||
|
||||
@override
|
||||
Future<bool> toggle(String dramaId) async {
|
||||
@@ -80,4 +88,11 @@ class InMemoryFavoriteRepository implements FavoriteRepository {
|
||||
if (failRemove) throw StateError('favorite unavailable');
|
||||
_saved.remove(dramaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> removeMany(List<String> dramaIds) async {
|
||||
removeManyCalls += 1;
|
||||
if (failRemove) throw StateError('favorite unavailable');
|
||||
_saved.removeAll(dramaIds);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../models/auth_session.dart';
|
||||
@@ -9,7 +11,7 @@ import 'auth_session_store.dart';
|
||||
///
|
||||
/// 职责:本地会话的读写([AuthSessionStore])、注册/登录/登出、令牌刷新;
|
||||
/// 也是 [ApiClient] 的 `accessTokenReader` / `tokenRefresher` / `onUnauthorized` 实现方 ——
|
||||
/// 401 → 刷新 → 重试失败就清会话,UI 通过 [isSignedIn] 自动回到未登录态。
|
||||
/// 401 → 刷新 → 重试。令牌被拒绝才清会话,服务中断时保持登录。
|
||||
class AuthController extends ChangeNotifier {
|
||||
AuthController(this._api, this._store);
|
||||
|
||||
@@ -19,6 +21,10 @@ class AuthController extends ChangeNotifier {
|
||||
AuthSession? _session;
|
||||
String _deviceId = '';
|
||||
bool _loaded = false;
|
||||
Future<bool>? _refreshing;
|
||||
|
||||
/// 登录已过期、账号停用才清本地会话。服务不可达不能当成退出登录。
|
||||
static const Set<int> _rejectedSessionCodes = {401, 100001};
|
||||
|
||||
bool get isLoaded => _loaded;
|
||||
bool get isSignedIn => _session != null;
|
||||
@@ -43,6 +49,7 @@ class AuthController extends ChangeNotifier {
|
||||
password: password,
|
||||
deviceId: await _store.deviceId(),
|
||||
platform: _platform,
|
||||
osVersion: _osVersion,
|
||||
);
|
||||
await _apply(session);
|
||||
}
|
||||
@@ -53,14 +60,12 @@ class AuthController extends ChangeNotifier {
|
||||
password: password,
|
||||
deviceId: await _store.deviceId(),
|
||||
platform: _platform,
|
||||
osVersion: _osVersion,
|
||||
);
|
||||
await _apply(session);
|
||||
}
|
||||
|
||||
Future<void> sendOtp({
|
||||
required String target,
|
||||
String scene = 'LOGIN',
|
||||
}) async {
|
||||
Future<void> sendOtp({required String target, String scene = 'LOGIN'}) async {
|
||||
await _api.sendOtp(
|
||||
target: target,
|
||||
scene: scene,
|
||||
@@ -77,6 +82,7 @@ class AuthController extends ChangeNotifier {
|
||||
code: code,
|
||||
deviceId: await _store.deviceId(),
|
||||
platform: _platform,
|
||||
osVersion: _osVersion,
|
||||
);
|
||||
await _apply(session);
|
||||
}
|
||||
@@ -90,10 +96,17 @@ class AuthController extends ChangeNotifier {
|
||||
code: code,
|
||||
deviceId: await _store.deviceId(),
|
||||
platform: _platform,
|
||||
osVersion: _osVersion,
|
||||
);
|
||||
await _apply(session);
|
||||
}
|
||||
|
||||
Future<void> clear() async {
|
||||
_session = null;
|
||||
await _store.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> signOut() async {
|
||||
final refreshToken = _session?.refreshToken ?? '';
|
||||
_session = null;
|
||||
@@ -107,29 +120,43 @@ class AuthController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 供 [ApiClient] 调用:刷新令牌并落盘。失败时清本地会话。
|
||||
Future<bool> refresh() async {
|
||||
/// 供 [ApiClient] 调用:刷新令牌并落盘。
|
||||
///
|
||||
/// 同一时刻只刷新一次,避免重启期间并发 401 把新令牌轮换掉。
|
||||
/// 网络失败或 5xx 保留本地会话;只有令牌被拒绝才退出登录。
|
||||
Future<bool> refresh() {
|
||||
final current = _refreshing;
|
||||
if (current != null) return current;
|
||||
final run = _refreshSingle();
|
||||
_refreshing = run;
|
||||
return run.whenComplete(() {
|
||||
if (identical(_refreshing, run)) _refreshing = null;
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> _refreshSingle() async {
|
||||
final refreshToken = _session?.refreshToken ?? '';
|
||||
if (refreshToken.isEmpty) {
|
||||
await clear();
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await _apply(await _api.refresh(refreshToken));
|
||||
await _apply(
|
||||
await _api.refresh(
|
||||
refreshToken,
|
||||
platform: _platform,
|
||||
osVersion: _osVersion,
|
||||
),
|
||||
);
|
||||
return true;
|
||||
} on ApiException catch (error) {
|
||||
if (_rejectedSessionCodes.contains(error.code)) await clear();
|
||||
return false;
|
||||
} catch (_) {
|
||||
await clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> clear() async {
|
||||
if (_session == null) return;
|
||||
_session = null;
|
||||
await _store.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 资料保存成功后同步登录态摘要,保留当前令牌。
|
||||
Future<void> applyProfile(AuthUser user) async {
|
||||
final current = _session;
|
||||
@@ -154,4 +181,9 @@ class AuthController extends ChangeNotifier {
|
||||
if (kIsWeb) return 'WEB';
|
||||
return defaultTargetPlatform == TargetPlatform.iOS ? 'IOS' : 'ANDROID';
|
||||
}
|
||||
|
||||
String get _osVersion {
|
||||
if (kIsWeb) return '';
|
||||
return Platform.operatingSystemVersion;
|
||||
}
|
||||
}
|
||||
@@ -161,6 +161,37 @@ class FavoriteController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 一次取消多部收藏。失败时整批回滚。
|
||||
Future<bool> removeMany(List<String> dramaIds) async {
|
||||
final ids = dramaIds.toSet();
|
||||
if (ids.isEmpty) return true;
|
||||
final previousCards = cards;
|
||||
final previousTotal = total;
|
||||
final previousHasMore = hasMore;
|
||||
final removed = cards.where((drama) => ids.contains(drama.id)).toList();
|
||||
if (removed.isEmpty) return true;
|
||||
cards = cards.where((drama) => !ids.contains(drama.id)).toList();
|
||||
for (final id in ids) {
|
||||
_saved.remove(id);
|
||||
}
|
||||
total = total > removed.length ? total - removed.length : 0;
|
||||
hasMore = cards.length < total;
|
||||
notify();
|
||||
try {
|
||||
await _repository.removeMany(dramaIds);
|
||||
return true;
|
||||
} catch (_) {
|
||||
cards = previousCards;
|
||||
total = previousTotal;
|
||||
hasMore = previousHasMore;
|
||||
for (final drama in removed) {
|
||||
_saved.add(drama.id);
|
||||
}
|
||||
notify();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// 取消收藏("我的"页列表里删除某条)。
|
||||
Future<bool> remove(String dramaId) async {
|
||||
final index = cards.indexWhere((drama) => drama.id == dramaId);
|
||||
|
||||
@@ -5,6 +5,10 @@ import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../models/drama.dart';
|
||||
import '../models/player_port.dart';
|
||||
import 'video_player_port.dart';
|
||||
|
||||
/// 新纹理第一帧常是黑的,旧画面只盖住这一小段。
|
||||
const Duration _qualityHandoffHold = Duration(milliseconds: 200);
|
||||
|
||||
typedef PlayerFactory = PlayerPort Function(Episode episode);
|
||||
typedef PlayerPreparation =
|
||||
@@ -66,6 +70,7 @@ class PlaybackSession extends ChangeNotifier {
|
||||
final Set<_PlayerSlot> _live = {};
|
||||
_PlayerSlot? _active;
|
||||
_PlayerSlot? _next;
|
||||
_PlayerSlot? _handoff;
|
||||
Future<void> _operations = Future<void>.value();
|
||||
Future<void> _preloadTask = Future<void>.value();
|
||||
int _generation = 0;
|
||||
@@ -127,6 +132,15 @@ class PlaybackSession extends ChangeNotifier {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// 清晰度切换时盖住黑帧的旧播放器。只在仍由会话持有时交给界面。
|
||||
PlayerPort? handoffAt(int index) {
|
||||
final slot = _handoff;
|
||||
if (_closed || slot == null || slot.retiring || slot.index != index) {
|
||||
return null;
|
||||
}
|
||||
return slot.player;
|
||||
}
|
||||
|
||||
/// 队列重排后把当前仍在播放的 slot 映射到新索引,不重新创建播放器。
|
||||
void remapCurrentIndex(int index, {int? preloadIndex}) {
|
||||
if (_closed || index < 0 || index >= episodes.length) return;
|
||||
@@ -184,9 +198,10 @@ class PlaybackSession extends ChangeNotifier {
|
||||
Future<void> _retire(_PlayerSlot? slot) async {
|
||||
if (slot == null || !_live.contains(slot)) return;
|
||||
slot.retiring = true;
|
||||
final cleared = _active == slot || _next == slot;
|
||||
final cleared = _active == slot || _next == slot || _handoff == slot;
|
||||
if (_active == slot) _active = null;
|
||||
if (_next == slot) _next = null;
|
||||
if (_handoff == slot) _handoff = null;
|
||||
if (cleared) _notify();
|
||||
await waitForFrame?.call();
|
||||
await slot.ready;
|
||||
@@ -235,6 +250,7 @@ class PlaybackSession extends ChangeNotifier {
|
||||
_PlayerSlot? target;
|
||||
await _enqueue(() async {
|
||||
if (_closed || request != _generation) return;
|
||||
await _retire(_handoff);
|
||||
final old = _active;
|
||||
if (old != null &&
|
||||
old.index == index &&
|
||||
@@ -272,6 +288,108 @@ class PlaybackSession extends ChangeNotifier {
|
||||
if (!_closed && request == _generation) _schedulePreload();
|
||||
}
|
||||
|
||||
/// 后台准备新片源,成功后再替换当前播放器。失败时原播放器保持不动。
|
||||
Future<bool> replaceCurrent() async {
|
||||
if (_closed || !_selected) return false;
|
||||
final index = _currentIndex;
|
||||
if (index < 0 || index >= episodes.length || isLocked) return false;
|
||||
if (!canPlay(episodes[index])) return false;
|
||||
final request = _generation;
|
||||
final slot = await _prepareReplacement(index, request);
|
||||
if (slot == null) {
|
||||
await _resumeActive();
|
||||
return false;
|
||||
}
|
||||
await slot.ready;
|
||||
if (!_replacementReady(slot, request)) {
|
||||
await _dropReplacement(slot);
|
||||
await _resumeActive();
|
||||
return false;
|
||||
}
|
||||
final previous = await _showReplacement(slot, request);
|
||||
if (_active != slot) {
|
||||
await _dropReplacement(slot);
|
||||
return false;
|
||||
}
|
||||
await _enqueue(() => _start(slot, request));
|
||||
await Future<void>.delayed(_qualityHandoffHold);
|
||||
if (previous != null && _handoff == previous && _active == slot) {
|
||||
await _enqueue(() => _retire(previous));
|
||||
}
|
||||
if (!_closed && request == _generation) _schedulePreload();
|
||||
return _active == slot && slot.failure == null;
|
||||
}
|
||||
|
||||
Future<_PlayerSlot?> _prepareReplacement(int index, int request) async {
|
||||
_PlayerSlot? created;
|
||||
await _enqueue(() async {
|
||||
if (_closed || request != _generation || _active == null) return;
|
||||
final warm = _next;
|
||||
_next = null;
|
||||
await _retire(_handoff);
|
||||
await _retire(warm);
|
||||
if (_closed || request != _generation || _active == null) return;
|
||||
try {
|
||||
created = _create(index);
|
||||
} catch (_) {
|
||||
created = null;
|
||||
}
|
||||
});
|
||||
return created;
|
||||
}
|
||||
|
||||
bool _replacementReady(_PlayerSlot slot, int request) {
|
||||
return !_closed &&
|
||||
request == _generation &&
|
||||
_active != null &&
|
||||
slot.failure == null &&
|
||||
slot.prepared;
|
||||
}
|
||||
|
||||
Future<void> _resumeActive() async {
|
||||
final slot = _active;
|
||||
if (slot == null || !_userWantsPlay || _closed) return;
|
||||
await _enqueue(() => _applyPlayback(slot));
|
||||
}
|
||||
|
||||
Future<void> _dropReplacement(_PlayerSlot slot) {
|
||||
return _enqueue(() async {
|
||||
if (_live.contains(slot)) await _retire(slot);
|
||||
});
|
||||
}
|
||||
|
||||
/// 先把已出画的新播放器交到界面上,旧播放器留给调用方稍后释放。
|
||||
Future<_PlayerSlot?> _showReplacement(_PlayerSlot slot, int request) async {
|
||||
_PlayerSlot? previous;
|
||||
var shown = false;
|
||||
await _enqueue(() async {
|
||||
if (!_replacementReady(slot, request)) return;
|
||||
previous = _active;
|
||||
await _catchUp(slot, previous);
|
||||
_handoff = previous;
|
||||
_active = slot;
|
||||
shown = true;
|
||||
if (previous != null) await previous!.player.pause();
|
||||
_notify();
|
||||
});
|
||||
if (!shown || _active != slot) return null;
|
||||
return previous;
|
||||
}
|
||||
|
||||
/// 旧片仍在播,把新片对齐到当前进度,盖住时画面才接得上。
|
||||
Future<void> _catchUp(_PlayerSlot slot, _PlayerSlot? previous) async {
|
||||
final next = slot.player;
|
||||
final current = previous?.player;
|
||||
if (next is! VideoPlayerPort || current is! VideoPlayerPort) return;
|
||||
final position = current.controller.value.position;
|
||||
if (position <= Duration.zero) return;
|
||||
try {
|
||||
await next.seekTo(position);
|
||||
} catch (_) {
|
||||
// 对齐失败仍用准备阶段的进度,不因此放弃切换。
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _start(_PlayerSlot slot, int request) async {
|
||||
bool valid() => !_closed && request == _generation && _active == slot;
|
||||
if (!valid()) return;
|
||||
@@ -387,7 +505,7 @@ class PlaybackSession extends ChangeNotifier {
|
||||
Future<void> _releasePlayers() {
|
||||
_generation++;
|
||||
return _enqueue(() async {
|
||||
_active = _next = null;
|
||||
_active = _next = _handoff = null;
|
||||
_loading = false;
|
||||
_notify();
|
||||
for (final slot in _live.toList()) {
|
||||
|
||||
@@ -122,6 +122,8 @@ abstract interface class SpriteThumbnailAxisSource implements Listenable {
|
||||
SpriteThumbnailFrame? cachedFrameAt(String? thumbnailsUrl, Duration position);
|
||||
|
||||
bool hasAxis(String? thumbnailsUrl);
|
||||
|
||||
Future<void> prepareAt(String? thumbnailsUrl, Duration position);
|
||||
}
|
||||
|
||||
/// VTT 时间轴、cue 二分与 sprite ui.Image LRU 缓存。
|
||||
@@ -153,6 +155,7 @@ class SpriteThumbnailAxisService extends ChangeNotifier
|
||||
List<String> get spriteCacheKeys => _spriteCache.keys.toList();
|
||||
|
||||
/// 播放器就绪时预取当前 cue 与相邻 sprite,拖动帧不触发网络或解码。
|
||||
@override
|
||||
Future<void> prepareAt(String? thumbnailsUrl, Duration position) async {
|
||||
final url = _normalizeUrl(thumbnailsUrl);
|
||||
if (_disposed || url == null) return;
|
||||
|
||||
@@ -2,6 +2,37 @@
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
/// 按后端 `ErrorCode` 取当前语言文案。未收录的业务码回退服务端 message。
|
||||
String userFacingApiMessage(AppLocalizations l10n, int code, String message) {
|
||||
final localized = _apiMessage(l10n, code);
|
||||
if (localized != null) return localized;
|
||||
if (message.isEmpty) return l10n.authServerError;
|
||||
return message;
|
||||
}
|
||||
|
||||
/// 已定义错误码。500 用服务繁忙,不展示「系统异常」。
|
||||
String? _apiMessage(AppLocalizations l10n, int code) {
|
||||
return switch (code) {
|
||||
400 => l10n.apiErrorBadRequest,
|
||||
401 => l10n.apiErrorUnauthorized,
|
||||
403 => l10n.apiErrorForbidden,
|
||||
404 => l10n.apiErrorNotFound,
|
||||
429 => l10n.apiErrorTooManyRequests,
|
||||
500 => l10n.authServerError,
|
||||
100000 => l10n.apiErrorLoginFailed,
|
||||
100001 => l10n.apiErrorAccountDisabled,
|
||||
100002 => l10n.apiErrorCoinNotEnough,
|
||||
100003 => l10n.apiErrorEpisodeUnavailable,
|
||||
100004 => l10n.apiErrorEpisodeUnlocked,
|
||||
100005 => l10n.apiErrorOrderInvalid,
|
||||
100006 => l10n.apiErrorVipExpired,
|
||||
200001 => l10n.apiErrorDataExists,
|
||||
200002 => l10n.apiErrorDataNotFound,
|
||||
200003 => l10n.apiErrorNotAllowed,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
/// logic 里的错误在两种情况下是"哨兵值":本地网络异常(读不到后端提示语)与
|
||||
/// 我们自己包装的失败。这里统一翻译成当前语言的文案;服务端给的中文提示原样展示。
|
||||
String errorText(AppLocalizations l10n, String? code, String fallback) {
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:html/dom.dart' as dom;
|
||||
import 'package:html/parser.dart' as html_parser;
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
|
||||
const double _bodySize = 16;
|
||||
const double _headingSize = 18;
|
||||
const double _blockGap = 12;
|
||||
const double _lineHeight = 1.7;
|
||||
|
||||
const TextStyle _bodyStyle = TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: _bodySize,
|
||||
height: _lineHeight,
|
||||
);
|
||||
|
||||
/// 把协议页的 HTML 正文画成普通控件。
|
||||
class LegalArticleView extends StatelessWidget {
|
||||
const LegalArticleView({super.key, required this.html});
|
||||
|
||||
final String html;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final fragment = html_parser.parseFragment(html);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
for (final node in fragment.nodes) _block(node),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _block(dom.Node node) {
|
||||
if (node is! dom.Element) {
|
||||
return _paragraph(node.text ?? '');
|
||||
}
|
||||
switch (node.localName) {
|
||||
case 'h1':
|
||||
case 'h2':
|
||||
case 'h3':
|
||||
return _heading(node.text);
|
||||
case 'ul':
|
||||
case 'ol':
|
||||
return _list(node);
|
||||
case 'pre':
|
||||
return _paragraph(node.text);
|
||||
case 'blockquote':
|
||||
return _paragraph(node.text);
|
||||
default:
|
||||
return _paragraphSpan(node);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _heading(String text) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: _blockGap),
|
||||
child: Text(
|
||||
text.trim(),
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: _headingSize,
|
||||
height: 1.4,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _list(dom.Element element) {
|
||||
final items = element.children.where((child) => child.localName == 'li');
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: _blockGap),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
for (final item in items)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Text('• ${item.text.trim()}', style: _bodyStyle),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _paragraph(String text) {
|
||||
final value = text.trim();
|
||||
if (value.isEmpty) return const SizedBox.shrink();
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: _blockGap),
|
||||
child: Text(value, style: _bodyStyle),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _paragraphSpan(dom.Element element) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: _blockGap),
|
||||
child: Text.rich(TextSpan(style: _bodyStyle, children: _inlines(element))),
|
||||
);
|
||||
}
|
||||
|
||||
List<InlineSpan> _inlines(dom.Node node) {
|
||||
if (node is dom.Text) {
|
||||
return [TextSpan(text: node.text)];
|
||||
}
|
||||
if (node is! dom.Element) return const [];
|
||||
final children = node.nodes.expand(_inlines).toList();
|
||||
switch (node.localName) {
|
||||
case 'strong':
|
||||
case 'b':
|
||||
return [TextSpan(style: const TextStyle(fontWeight: FontWeight.w700), children: children)];
|
||||
case 'em':
|
||||
case 'i':
|
||||
return [TextSpan(style: const TextStyle(fontStyle: FontStyle.italic), children: children)];
|
||||
case 'a':
|
||||
return [TextSpan(style: const TextStyle(color: AppColors.blue), children: children)];
|
||||
case 'br':
|
||||
return const [TextSpan(text: '\n')];
|
||||
default:
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../config/app_config.dart';
|
||||
|
||||
final RegExp _articlePattern = RegExp(
|
||||
'<article>([\\s\\S]*)</article>',
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
/// 从协议页里取出正文。没有 article 时退回整页。
|
||||
String legalArticle(String html) {
|
||||
final match = _articlePattern.firstMatch(html);
|
||||
final body = match?.group(1);
|
||||
if (body == null || body.trim().isEmpty) return html;
|
||||
return body.trim();
|
||||
}
|
||||
|
||||
/// 拉取协议页 HTML。不走业务 JSON 包装。
|
||||
Future<String> fetchLegalArticle(String url) async {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
connectTimeout: AppConfig.requestTimeout,
|
||||
receiveTimeout: AppConfig.requestTimeout,
|
||||
responseType: ResponseType.plain,
|
||||
validateStatus: (code) => code != null && code >= 200 && code < 300,
|
||||
),
|
||||
);
|
||||
final response = await dio.get<String>(url);
|
||||
final body = response.data;
|
||||
if (body == null || body.trim().isEmpty) {
|
||||
throw StateError('empty legal page');
|
||||
}
|
||||
return legalArticle(body);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'legal_web_page.dart';
|
||||
|
||||
/// 在当前 App 里打开协议地址。
|
||||
Future<void> openLegalUrlOrNotify(BuildContext context, String url) {
|
||||
return Navigator.of(context).push<void>(
|
||||
MaterialPageRoute<void>(builder: (_) => LegalWebPage(url: url)),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../config/app_config.dart';
|
||||
|
||||
/// 隐私协议公开路径,对应 `/privacy/{语言}`。
|
||||
const String legalPrivacyPath = 'privacy';
|
||||
|
||||
/// 服务条款公开路径,对应 `/terms/{语言}`。
|
||||
const String legalTermsPath = 'terms';
|
||||
|
||||
const Set<String> _legalLanguages = {'zh', 'en', 'id'};
|
||||
|
||||
/// 界面语言落到协议页支持的三种语言。其余语言用英文。
|
||||
String legalLanguageCode(Locale locale) {
|
||||
final code = locale.languageCode;
|
||||
if (_legalLanguages.contains(code)) return code;
|
||||
return 'en';
|
||||
}
|
||||
|
||||
/// 拼出当前服务器上的协议页地址。
|
||||
String legalPageUrl(String path, Locale locale) {
|
||||
final base = AppConfig.apiBaseUrl;
|
||||
final root = base.endsWith('/') ? base.substring(0, base.length - 1) : base;
|
||||
return '$root/$path/${legalLanguageCode(locale)}';
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../widgets/plain_page_scaffold.dart';
|
||||
import 'legal_article_view.dart';
|
||||
import 'legal_html.dart';
|
||||
|
||||
const double _pagePadding = 20;
|
||||
|
||||
/// 在应用内展示协议页,不使用系统 WebView。
|
||||
class LegalWebPage extends StatefulWidget {
|
||||
const LegalWebPage({super.key, required this.url, this.load});
|
||||
|
||||
final String url;
|
||||
|
||||
/// 测试时可替换网络请求。
|
||||
final Future<String> Function(String url)? load;
|
||||
|
||||
@override
|
||||
State<LegalWebPage> createState() => _LegalWebPageState();
|
||||
}
|
||||
|
||||
class _LegalWebPageState extends State<LegalWebPage> {
|
||||
String? _html;
|
||||
var _failed = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
setState(() {
|
||||
_html = null;
|
||||
_failed = false;
|
||||
});
|
||||
try {
|
||||
final loader = widget.load ?? fetchLegalArticle;
|
||||
final html = await loader(widget.url);
|
||||
if (!mounted) return;
|
||||
setState(() => _html = html);
|
||||
} catch (_) {
|
||||
if (!mounted) return;
|
||||
setState(() => _failed = true);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PlainPageScaffold(
|
||||
pageKey: const Key('legal-web-page'),
|
||||
backKey: const Key('legal-web-back'),
|
||||
title: '',
|
||||
child: _body(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _body(BuildContext context) {
|
||||
final html = _html;
|
||||
if (html != null) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.fromLTRB(_pagePadding, 8, _pagePadding, 28),
|
||||
children: [
|
||||
LegalArticleView(html: html),
|
||||
],
|
||||
);
|
||||
}
|
||||
if (_failed) return _failure(context);
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
key: Key('legal-web-loading'),
|
||||
color: AppColors.blue,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _failure(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(l10n.legalOpenFailed, style: const TextStyle(color: AppColors.muted)),
|
||||
TextButton(
|
||||
key: const Key('legal-web-retry'),
|
||||
onPressed: _load,
|
||||
child: Text(l10n.retry),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ abstract final class AppColors {
|
||||
static const scrim = Color(0xD1000000);
|
||||
static const controlScrim = Color(0x80000000);
|
||||
static const controlSoftScrim = Color(0x42000000);
|
||||
static const timeBubbleScrim = Color(0xB3000000);
|
||||
static const scrubPreviewScrim = Color(0xDE000000);
|
||||
static const overlaySoft = Color(0x66000000);
|
||||
static const overlayBar = Color(0x4D000000);
|
||||
@@ -34,8 +35,8 @@ abstract final class AppColors {
|
||||
/// 主操作按下态。
|
||||
static const bluePressed = Color(0xFFE55A1F);
|
||||
|
||||
/// 链接与次要高亮(禁止大面积铺色)。
|
||||
static const blueSoft = Color(0xFF22D3EE);
|
||||
/// 链接与次要高亮:统一改用中性浅灰,避免旧青色残留。
|
||||
static const blueSoft = Color(0xFFB0B0B0);
|
||||
static const secondary = blueSoft;
|
||||
static const lavender = blueSoft;
|
||||
|
||||
@@ -49,6 +50,7 @@ abstract final class AppColors {
|
||||
static const vipBadgeSurface = Color(0x1F3D2408);
|
||||
static const bronze = Color(0xFFCD7F32);
|
||||
static const bronzeDeep = Color(0xFFA9713A);
|
||||
static const rankSilver = Color(0xFFC0C0C0);
|
||||
|
||||
/// 成功状态。
|
||||
static const success = Color(0xFF2FA873);
|
||||
@@ -58,6 +60,8 @@ abstract final class AppColors {
|
||||
|
||||
/// 收藏与喜欢(非主色铺色,独立强调)。
|
||||
static const favorite = Color(0xFFFF6A8A);
|
||||
static const doubleTapHeartRed = Color(0xFFFF4D6D);
|
||||
static const doubleTapHeartPink = Color(0xFFFF7A9A);
|
||||
|
||||
/// 金币底色上的文字。
|
||||
static const onGold = Color(0xFF3D2408);
|
||||
@@ -66,33 +70,57 @@ abstract final class AppColors {
|
||||
static const onPrimary = Color(0xFFFFFFFF);
|
||||
|
||||
/// 页面背景。
|
||||
static const ink = Color(0xFF0B1020);
|
||||
static const ink = Color(0xFF000000);
|
||||
|
||||
/// 首页/追剧/我的统一的纯黑内容背景。
|
||||
static const appBackground = Color(0xFF000000);
|
||||
|
||||
/// 中性深灰卡片与控件表面。
|
||||
static const contentCard = Color(0xFF171717);
|
||||
static const contentCard = Color(0xFF16161A);
|
||||
static const contentSurface = Color(0xFF1C1C1E);
|
||||
static const skeletonSurface = Color(0xFF141414);
|
||||
static const contentChip = Color(0xFF2C2C2E);
|
||||
static const contentBorder = Color(0x1AFFFFFF);
|
||||
static const filterChipSelected = Color(0xFF21090E);
|
||||
static const filterChipTextSelected = Color(0xFFFF4D6A);
|
||||
static const filterChipTextInactive = Color(0xFF8A8A8A);
|
||||
|
||||
/// 「我的」页卡片与描边。
|
||||
static const mineCard = Color(0xFF16161A);
|
||||
static const mineOutline = Color(0xFF4A4A4A);
|
||||
static const mineGradientTop = Color(0xFF3A1B0E);
|
||||
static const mineGradientMiddle = Color(0xFF1A0C07);
|
||||
static const mineGradientBottom = Color(0xFF000000);
|
||||
static const mineGradientGlow = Color(0x33FF6B2C);
|
||||
static const mineGridSurface = Color(0x99101010);
|
||||
static const minePanelSurface = Color(0xFF101010);
|
||||
static const mineMoreDivider = Color(0xFF1C1C1E);
|
||||
static const mineGridDivider = Color(0xFF2A2A2A);
|
||||
static const mineGridIconSurface = Color(0xFF1C1C1E);
|
||||
static const mineGridLabel = Color(0xFFE6E6EB);
|
||||
static const mineIconWallet = Color(0xFFF5C451);
|
||||
static const mineIconDownloads = Color(0xFF4DA3FF);
|
||||
static const mineIconHistory = Color(0xFF4ADE80);
|
||||
static const mineIconPreferences = Color(0xFFFF6B9A);
|
||||
static const mineIconSupport = Color(0xFFA78BFA);
|
||||
static const mineIconLanguage = Color(0xFF22D3EE);
|
||||
static const mineIconSettings = Color(0xFFA1A1AA);
|
||||
static const mineIconNotices = Color(0xFFFF8A4C);
|
||||
static const recommendPlaylistGlow = Color(0x26FF6B2C);
|
||||
|
||||
/// 次级文字与列表 chevron。
|
||||
static const textPrimary = Color(0xFFFFFFFF);
|
||||
static const textSecondary = Color(0xFF8E8E93);
|
||||
static const textTertiary = Color(0xFF9E9E9E);
|
||||
static const textSecondary = Color(0xFFB0B0B0);
|
||||
static const textTertiary = Color(0xFF8E8E93);
|
||||
static const textTabInactive = Color(0xFFB0B0B0);
|
||||
static const textFilterIcon = Color(0xFF7A7A7E);
|
||||
static const searchResultMeta = Color(0xFF9E9E9E);
|
||||
|
||||
/// 原生开屏与冷启动过渡底色。
|
||||
static const splashInk = ink;
|
||||
|
||||
/// 顶部与页面底同色,靠容器层次区分。
|
||||
static const surfaceTop = ink;
|
||||
/// 页面顶部暖黑色,渐变底部仍收口到纯黑。
|
||||
static const surfaceTop = mineGradientTop;
|
||||
|
||||
/// 底部导航底色。
|
||||
static const bar = ink;
|
||||
@@ -105,13 +133,13 @@ abstract final class AppColors {
|
||||
static const cardShadow = Color(0x00000000);
|
||||
|
||||
/// 卡片与列表容器。
|
||||
static const card = Color(0xFF151B2E);
|
||||
static const card = Color(0xFF16161A);
|
||||
|
||||
/// 次要卡片表面。
|
||||
static const cardAlt = card;
|
||||
static const cardAlt = Color(0xFF101010);
|
||||
|
||||
/// 浮层、弹窗、输入与嵌套区域。
|
||||
static const raised = Color(0xFF1C2436);
|
||||
static const raised = Color(0xFF1C1C1E);
|
||||
static const quick = raised;
|
||||
static const input = raised;
|
||||
|
||||
@@ -134,13 +162,13 @@ abstract final class AppColors {
|
||||
/// 橙色强调文案。
|
||||
static const accent = blue;
|
||||
|
||||
/// 分割线 rgba(255,255,255,0.06)。
|
||||
static const border = Color(0x0FFFFFFF);
|
||||
/// 统一卡片描边、分割线与输入框边框。
|
||||
static const border = Color(0xFF1C1C1E);
|
||||
|
||||
/// 玻璃面板描边。
|
||||
static const glassBorder = Color(0x33FFFFFF);
|
||||
static const glassSurfaceStart = Color(0xEB1C2436);
|
||||
static const glassSurfaceEnd = Color(0xD1151B2E);
|
||||
static const glassSurfaceStart = Color(0xEB16161A);
|
||||
static const glassSurfaceEnd = Color(0xD1101010);
|
||||
|
||||
/// 角标底与文字。
|
||||
static const badgePink = Color(0x33FF6A8A);
|
||||
@@ -165,6 +193,7 @@ abstract final class AppColors {
|
||||
|
||||
/// 播放器控件胶囊与圆形底色。
|
||||
static const playerOverlayPill = Color(0xB3000000);
|
||||
static const refreshIndicatorSurface = Color(0x99000000);
|
||||
static const cardBottomScrimStart = Color(0x00000000);
|
||||
static const cardBottomScrimEnd = Color(0x40000000);
|
||||
|
||||
@@ -172,7 +201,7 @@ abstract final class AppColors {
|
||||
static const inactiveTrack = Color(0x24FFFFFF);
|
||||
|
||||
/// 横幅/封面底部渐变。
|
||||
static const bannerScrimMid = Color(0x8A0B1020);
|
||||
static const bannerScrimMid = Color(0x8A1A0C07);
|
||||
static const bannerScrimEnd = Color(0xE6000000);
|
||||
|
||||
/// 票券虚线等主色描边。
|
||||
|
||||
@@ -53,10 +53,21 @@ abstract final class AppDimens {
|
||||
static const double progressHeight = 3;
|
||||
static const double progressRadius = 2;
|
||||
static const double progressLineHeight = 3;
|
||||
static const double refreshIndicatorSize = 40;
|
||||
static const double refreshIndicatorRadius = 20;
|
||||
static const double refreshSpinnerSize = 20;
|
||||
static const double refreshSpinnerStroke = 2;
|
||||
static const double loadMoreIndicatorHeight = 40;
|
||||
|
||||
static const double searchHeight = 40;
|
||||
static const double searchRadius = 8;
|
||||
static const double searchPlaceholderFont = 13;
|
||||
static const double searchResultGap = 12;
|
||||
static const double searchResultRowGap = 16;
|
||||
static const double searchResultTitleGap = 8;
|
||||
static const double searchResultMetaGap = 6;
|
||||
static const double searchResultMetaFont = 12;
|
||||
static const double searchResultTextExtent = 68;
|
||||
static const double navDot = 3;
|
||||
static const double glassBlur = 24;
|
||||
|
||||
@@ -99,6 +110,11 @@ abstract final class AppDimens {
|
||||
static const double cardBadgeFont = 9;
|
||||
static const double cardCoverTitleGap = 6;
|
||||
static const double cardTitleTagGap = 6;
|
||||
static const double skeletonBarHeight = 10;
|
||||
static const double skeletonBarRadius = 4;
|
||||
static const double skeletonBarGap = 4;
|
||||
static const double skeletonTitleBarGap = 3;
|
||||
static const double skeletonBodyExtent = 34;
|
||||
static const double cardCoverAspectRatio = 3 / 4;
|
||||
static const double homeCardBodyExtent = 84;
|
||||
static const double homePrimaryTabFont = 18;
|
||||
@@ -136,20 +152,89 @@ abstract final class AppDimens {
|
||||
static const double recommendRowHeight = 252;
|
||||
static const double recommendCardWidth = 122;
|
||||
|
||||
/// 首页热播榜。
|
||||
static const double rankingHeroTitle = 22;
|
||||
static const double rankingHeroSubtitle = 11;
|
||||
static const double rankingPodiumChampionWidth = 110;
|
||||
static const double rankingPodiumChampionHeight = 146;
|
||||
static const double rankingPodiumWidth = 92;
|
||||
static const double rankingPodiumHeight = 122;
|
||||
static const double rankingPodiumRadius = 10;
|
||||
static const double rankingRowHeight = 96;
|
||||
static const double rankingNumberWidth = 56;
|
||||
static const double rankingNumberFont = 48;
|
||||
static const double rankingCoverWidth = 60;
|
||||
static const double rankingCoverHeight = 80;
|
||||
static const double rankingCoverRadius = 6;
|
||||
|
||||
/// 全部短剧筛选与追剧双列。
|
||||
static const double filterChipFont = 13;
|
||||
static const double filterChipHeight = 30;
|
||||
static const double filterChipRadius = 15;
|
||||
static const double followingTabFont = 16;
|
||||
static const double followingGridAspectRatio = 0.5;
|
||||
static const double filterChipFont = 16;
|
||||
static const double filterChipHeight = 32;
|
||||
static const double filterChipRadius = 16;
|
||||
static const double filterChipHorizontalPadding = 12;
|
||||
static const double filterRowGap = 6;
|
||||
static const double filterItemGap = 10;
|
||||
static const double allDramasHorizontal = 12;
|
||||
static const double allDramasGridGap = 6;
|
||||
static const double allDramasGridRowGap = 12;
|
||||
static const double allDramasFilterToGridGap = 12;
|
||||
static const double followingHeaderHeight = 52;
|
||||
static const double followingTabFont = 18;
|
||||
static const double followingTabGap = 24;
|
||||
static const double followingEditIconSize = 20;
|
||||
static const double followingEditHitSize = 40;
|
||||
static const double followingAddIconSize = 28;
|
||||
static const double followingAddIconStroke = 1.5;
|
||||
static const double followingGridGap = 6;
|
||||
static const double followingGridRowGap = 12;
|
||||
static const double followingCardTextExtent = 70;
|
||||
static const double followingSubtitleFont = 12;
|
||||
static const double followingSubtitleGap = 4;
|
||||
static const double followingProgressHeight = 2;
|
||||
static const double followingHistoryCoverWidth = 96;
|
||||
static const double followingHistoryCoverHeight = 128;
|
||||
static const double followingHistoryCoverRadius = 6;
|
||||
static const double followingHistoryContentGap = 12;
|
||||
static const double followingHistoryRowGap = 16;
|
||||
static const double followingHistoryProgressHeight = 3;
|
||||
static const double followingHistoryProgressRadius = 2;
|
||||
static const double followingHistoryProgressGap = 8;
|
||||
static const double followingHistoryLabelGap = 4;
|
||||
static const double followingHistoryActionHeight = 28;
|
||||
static const Duration followingTabAnimationDuration = Duration(
|
||||
milliseconds: 180,
|
||||
);
|
||||
static const Duration followingPageAnimationDuration = Duration(
|
||||
milliseconds: 220,
|
||||
);
|
||||
|
||||
/// 「我的」页中性视觉。
|
||||
static const double mineCardRadius = 16;
|
||||
static const double mineRowHeight = 56;
|
||||
static const double minePageTitle = 17;
|
||||
static const double mineSectionTitle = 15;
|
||||
static const double mineAvatar = 56;
|
||||
static const double mineUserName = 20;
|
||||
static const double mineUid = 13;
|
||||
static const double mineMenuIcon = 22;
|
||||
static const double mineUserNameLineHeight = 1.15;
|
||||
static const double mineUserNameUidGap = 2;
|
||||
static const double mineUid = 12;
|
||||
static const double mineUidRowHeight = 16;
|
||||
static const double mineCopyIcon = 14;
|
||||
static const double mineGridHorizontal = 14;
|
||||
static const double mineGridRadius = 12;
|
||||
static const double mineGridCellHeight = 96;
|
||||
static const double mineGridIconSurface = 44;
|
||||
static const double mineGridIcon = 22;
|
||||
static const double mineGridLabel = 12;
|
||||
static const double mineGridDividerWidth = 1;
|
||||
static const double mineSectionTitleFont = 16;
|
||||
static const double mineSectionLinkFont = 12;
|
||||
static const double mineSectionGap = 20;
|
||||
static const double mineContinueCardWidth = 96;
|
||||
static const double mineContinueRowHeight = 168;
|
||||
static const double mineContinueTitleFont = 13;
|
||||
static const double mineContinueMetaFont = 11;
|
||||
static const double mineStatsValueFont = 18;
|
||||
static const double mineStatsLabelFont = 11;
|
||||
static const double minePanelPadding = 12;
|
||||
static const double mineMoreRowHeight = 52;
|
||||
static const double mineMoreFont = 15;
|
||||
}
|
||||
@@ -8,12 +8,16 @@ import 'app_dimens.dart';
|
||||
|
||||
/// 深色视觉主题(默认且唯一)。
|
||||
abstract final class AppTheme {
|
||||
/// 页面背景:深色扁平,靠容器层次区分。
|
||||
/// 页面背景:顶部暖黑、底部纯黑,避免旧深蓝渐变。
|
||||
static const LinearGradient pageGradient = LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColors.surfaceTop, AppColors.ink],
|
||||
stops: [0, 0.24],
|
||||
colors: [
|
||||
AppColors.mineGradientTop,
|
||||
AppColors.mineGradientMiddle,
|
||||
AppColors.mineGradientBottom,
|
||||
],
|
||||
stops: [0, 0.4, 0.75],
|
||||
);
|
||||
|
||||
/// 卡片阴影关闭,改用底色与分割线。
|
||||
@@ -76,7 +80,7 @@ abstract final class AppTheme {
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.secondary,
|
||||
foregroundColor: AppColors.primary,
|
||||
shape: RoundedRectangleBorder(borderRadius: _buttonRadius),
|
||||
),
|
||||
),
|
||||
@@ -107,12 +111,12 @@ abstract final class AppTheme {
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
foregroundColor: const WidgetStatePropertyAll(AppColors.blue),
|
||||
foregroundColor: const WidgetStatePropertyAll(AppColors.textPrimary),
|
||||
minimumSize: const WidgetStatePropertyAll(
|
||||
Size(0, AppDimens.buttonHeight),
|
||||
),
|
||||
side: const WidgetStatePropertyAll(
|
||||
BorderSide(color: AppColors.border),
|
||||
BorderSide(color: AppColors.mineOutline),
|
||||
),
|
||||
shape: WidgetStatePropertyAll(
|
||||
RoundedRectangleBorder(borderRadius: _buttonRadius),
|
||||
@@ -148,20 +152,20 @@ abstract final class AppTheme {
|
||||
),
|
||||
),
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: AppColors.card,
|
||||
foregroundColor: AppColors.onSurface,
|
||||
backgroundColor: AppColors.transparent,
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
surfaceTintColor: AppColors.transparent,
|
||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
||||
titleTextStyle: TextStyle(
|
||||
color: AppColors.onSurface,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Outfit',
|
||||
fontSize: AppDimens.pageTitle,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
iconTheme: const IconThemeData(color: AppColors.onSurface),
|
||||
iconTheme: const IconThemeData(color: AppColors.textPrimary),
|
||||
dividerTheme: const DividerThemeData(
|
||||
color: AppColors.border,
|
||||
thickness: 1,
|
||||
|
||||
@@ -4,19 +4,18 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
|
||||
const double _maxPullDistance = 96;
|
||||
const double _refreshThreshold = 56;
|
||||
const double _indicatorHeight = 56;
|
||||
const double _indicatorDisplacement = 40;
|
||||
const Duration _arrowTurnDuration = Duration(milliseconds: 160);
|
||||
const Duration _settleDuration = Duration(milliseconds: 200);
|
||||
|
||||
enum _PullState { idle, pull, armed, refreshing }
|
||||
|
||||
/// 带文字状态提示的下拉刷新容器,指示区悬浮在内容上方。
|
||||
/// 下拉刷新容器,指示区只显示统一的白色加载圈。
|
||||
class AppPullToRefresh extends StatefulWidget {
|
||||
const AppPullToRefresh({
|
||||
super.key,
|
||||
@@ -172,7 +171,7 @@ class _AppPullToRefreshState extends State<AppPullToRefresh>
|
||||
top: widget.edgeOffset,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: IgnorePointer(child: _indicatorLayer(context, offset)),
|
||||
child: IgnorePointer(child: _indicatorLayer(offset)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -181,7 +180,7 @@ class _AppPullToRefreshState extends State<AppPullToRefresh>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _indicatorLayer(BuildContext context, double offset) {
|
||||
Widget _indicatorLayer(double offset) {
|
||||
final progress = (offset / _refreshThreshold).clamp(0.0, 1.0);
|
||||
return SizedBox(
|
||||
height: _indicatorHeight,
|
||||
@@ -193,7 +192,7 @@ class _AppPullToRefreshState extends State<AppPullToRefresh>
|
||||
alignment: Alignment.topCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: _indicator(context),
|
||||
child: _indicator(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -201,50 +200,25 @@ class _AppPullToRefreshState extends State<AppPullToRefresh>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _indicator(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
if (_state == _PullState.refreshing) {
|
||||
return _label(
|
||||
const SizedBox.square(
|
||||
dimension: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColors.navSelected,
|
||||
),
|
||||
),
|
||||
l10n.refreshingLabel,
|
||||
);
|
||||
}
|
||||
final armed = _state == _PullState.armed;
|
||||
return _label(
|
||||
AnimatedRotation(
|
||||
turns: armed ? 0.5 : 0,
|
||||
duration: _arrowTurnDuration,
|
||||
child: Icon(
|
||||
Icons.arrow_downward_rounded,
|
||||
size: 18,
|
||||
color: AppColors.navSelected,
|
||||
Widget _indicator() {
|
||||
return Container(
|
||||
key: const Key('pull-refresh-indicator'),
|
||||
width: AppDimens.refreshIndicatorSize,
|
||||
height: AppDimens.refreshIndicatorSize,
|
||||
padding: const EdgeInsets.all(
|
||||
(AppDimens.refreshIndicatorSize - AppDimens.refreshSpinnerSize) / 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.refreshIndicatorSurface,
|
||||
borderRadius: BorderRadius.circular(AppDimens.refreshIndicatorRadius),
|
||||
),
|
||||
child: const SizedBox.square(
|
||||
dimension: AppDimens.refreshSpinnerSize,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: AppDimens.refreshSpinnerStroke,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
armed ? l10n.releaseToRefresh : l10n.pullToRefresh,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _label(Widget icon, String text) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: AppColors.navSelected,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
|
||||
class DramaGridSkeleton extends StatelessWidget {
|
||||
const DramaGridSkeleton({
|
||||
super.key,
|
||||
required this.columns,
|
||||
required this.horizontalPadding,
|
||||
required this.crossAxisSpacing,
|
||||
required this.mainAxisSpacing,
|
||||
this.itemCount = 9,
|
||||
this.physics = const NeverScrollableScrollPhysics(),
|
||||
});
|
||||
|
||||
final int columns;
|
||||
final double horizontalPadding;
|
||||
final double crossAxisSpacing;
|
||||
final double mainAxisSpacing;
|
||||
final int itemCount;
|
||||
final ScrollPhysics physics;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final itemWidth =
|
||||
(constraints.maxWidth -
|
||||
horizontalPadding * 2 -
|
||||
crossAxisSpacing * (columns - 1)) /
|
||||
columns;
|
||||
final itemExtent =
|
||||
itemWidth / AppDimens.cardCoverAspectRatio +
|
||||
AppDimens.skeletonBodyExtent;
|
||||
return GridView.builder(
|
||||
physics: physics,
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
horizontalPadding,
|
||||
AppDimens.spaceMd,
|
||||
horizontalPadding,
|
||||
AppDimens.spaceXl,
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: columns,
|
||||
crossAxisSpacing: crossAxisSpacing,
|
||||
mainAxisSpacing: mainAxisSpacing,
|
||||
mainAxisExtent: itemExtent,
|
||||
),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) => Column(
|
||||
key: Key('drama-grid-skeleton-$index'),
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: AppDimens.cardCoverAspectRatio,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.skeletonSurface,
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimens.homeCardRadius,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppDimens.cardCoverTitleGap),
|
||||
const _SkeletonBar(),
|
||||
const SizedBox(height: AppDimens.skeletonTitleBarGap),
|
||||
const FractionallySizedBox(
|
||||
widthFactor: 0.62,
|
||||
child: _SkeletonBar(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SkeletonBar extends StatelessWidget {
|
||||
const _SkeletonBar();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: AppDimens.skeletonBarHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.skeletonSurface,
|
||||
borderRadius: BorderRadius.circular(AppDimens.skeletonBarRadius),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
|
||||
const double _regularIconSize = 48;
|
||||
const double _compactIconSize = 32;
|
||||
const double _regularIconSize = 72;
|
||||
const double _compactIconSize = 44;
|
||||
const double _maxContentWidth = 260;
|
||||
const double _regularHorizontal = 24;
|
||||
const double _regularVertical = 28;
|
||||
@@ -78,7 +78,7 @@ class EmptyState extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 空状态只留一枚图标,不加水印底和描边。
|
||||
/// 空列表只放一枚大图标,不画线框,也不铺底色。
|
||||
class _EmptyMark extends StatelessWidget {
|
||||
const _EmptyMark({required this.icon, required this.compact});
|
||||
|
||||
@@ -91,7 +91,7 @@ class _EmptyMark extends StatelessWidget {
|
||||
icon,
|
||||
key: const Key('empty-state-icon'),
|
||||
size: compact ? _compactIconSize : _regularIconSize,
|
||||
color: AppColors.blueSoft,
|
||||
color: AppColors.subtle,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,6 @@ class _EmptyCopy extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -126,10 +125,10 @@ class _EmptyCopy extends StatelessWidget {
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: scheme.onSurface,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textTertiary,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.35,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,22 +5,19 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
/// 网络分页列表底部状态:加载、重试、手动加载与无更多。
|
||||
/// 网络分页列表底部状态:仅保留加载圈与错误重试。
|
||||
class PagedListFooter extends StatelessWidget {
|
||||
const PagedListFooter({
|
||||
super.key,
|
||||
required this.loading,
|
||||
required this.hasMore,
|
||||
required this.hasItems,
|
||||
required this.onRetry,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
final bool loading;
|
||||
final bool hasMore;
|
||||
final bool hasItems;
|
||||
final String? errorMessage;
|
||||
final Future<void> Function() onRetry;
|
||||
|
||||
@@ -49,38 +46,18 @@ class PagedListFooter extends StatelessWidget {
|
||||
if (loading) {
|
||||
return const SizedBox(
|
||||
key: Key('paged-list-loading'),
|
||||
height: 56,
|
||||
height: AppDimens.loadMoreIndicatorHeight,
|
||||
child: Center(
|
||||
child: SizedBox.square(
|
||||
dimension: 20,
|
||||
dimension: AppDimens.refreshSpinnerSize,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColors.blue,
|
||||
strokeWidth: AppDimens.refreshSpinnerStroke,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (hasMore) {
|
||||
return Center(
|
||||
child: TextButton(
|
||||
key: const Key('paged-list-load-more'),
|
||||
onPressed: () => unawaited(onRetry()),
|
||||
child: Text(l10n.loadMore),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (hasItems) {
|
||||
return Padding(
|
||||
key: const Key('paged-list-no-more'),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
child: Text(
|
||||
l10n.noMore,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox(height: 16);
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
|
||||
const int _defaultPageSize = 20;
|
||||
const Duration _defaultLoadDelay = Duration(milliseconds: 300);
|
||||
@@ -64,53 +65,34 @@ class PagedLocalListController<T> extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 分页列表底部加载态与到底提示。
|
||||
/// 分页列表底部加载态。
|
||||
class PagedLoadFooter extends StatelessWidget {
|
||||
const PagedLoadFooter({
|
||||
super.key,
|
||||
required this.loading,
|
||||
required this.hasMore,
|
||||
required this.hasItems,
|
||||
required this.loadMoreKey,
|
||||
required this.noMoreKey,
|
||||
required this.noMoreLabel,
|
||||
});
|
||||
|
||||
final bool loading;
|
||||
final bool hasMore;
|
||||
final bool hasItems;
|
||||
final Key loadMoreKey;
|
||||
final Key noMoreKey;
|
||||
final String noMoreLabel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) {
|
||||
return SizedBox(
|
||||
key: loadMoreKey,
|
||||
height: 56,
|
||||
height: AppDimens.loadMoreIndicatorHeight,
|
||||
child: const Center(
|
||||
child: SizedBox.square(
|
||||
dimension: 20,
|
||||
dimension: AppDimens.refreshSpinnerSize,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppColors.blue,
|
||||
strokeWidth: AppDimens.refreshSpinnerStroke,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (hasItems && !hasMore) {
|
||||
return Padding(
|
||||
key: noMoreKey,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
child: Text(
|
||||
noMoreLabel,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: AppColors.muted, fontSize: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox(height: 16);
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import 'subpage_header.dart';
|
||||
|
||||
/// 二级页面通用骨架:返回栏 + 标题/副标题 + 可滚动内容,无底部导航。
|
||||
@@ -27,17 +28,20 @@ class PlainPageScaffold extends StatelessWidget {
|
||||
return Scaffold(
|
||||
key: pageKey,
|
||||
backgroundColor: AppColors.ink,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppSubpageHeader(
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
backKey: backKey,
|
||||
),
|
||||
Expanded(child: child),
|
||||
],
|
||||
body: DecoratedBox(
|
||||
decoration: const BoxDecoration(gradient: AppTheme.pageGradient),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppSubpageHeader(
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
backKey: backKey,
|
||||
),
|
||||
Expanded(child: child),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -31,34 +31,45 @@ class RemoteImage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final url = AppConfig.mediaUrl(path);
|
||||
if (url.isEmpty) return _fallback();
|
||||
if (url.isEmpty) return _fallback(brand: showFallbackIcon);
|
||||
return Image.network(
|
||||
url,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
errorBuilder: (_, _, _) => _fallback(),
|
||||
gaplessPlayback: true,
|
||||
errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon),
|
||||
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
||||
if (wasSynchronouslyLoaded || frame != null) return child;
|
||||
return _fallback();
|
||||
return _fallback(brand: showFallbackIcon);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _fallback() {
|
||||
Widget _fallback({required bool brand}) {
|
||||
final mark = brand
|
||||
? LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth.isFinite
|
||||
? constraints.maxWidth
|
||||
: 120.0;
|
||||
return Center(
|
||||
child: Image.asset(
|
||||
'assets/icon/splash_logo.png',
|
||||
key: fallbackIconKey,
|
||||
width: width * 0.72,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: null;
|
||||
final fallback = Container(
|
||||
width: width,
|
||||
height: height,
|
||||
color: fallbackColor,
|
||||
color: brand ? AppColors.mediaBlack : fallbackColor,
|
||||
alignment: Alignment.center,
|
||||
child: showFallbackIcon
|
||||
? Icon(
|
||||
Icons.image_not_supported_outlined,
|
||||
key: fallbackIconKey,
|
||||
color: AppColors.muted,
|
||||
size: 32,
|
||||
)
|
||||
: null,
|
||||
child: mark,
|
||||
);
|
||||
final ratio = fallbackAspectRatio;
|
||||
if (ratio == null) return fallback;
|
||||
|
||||
@@ -13,10 +13,10 @@ const double _titleFontSize = 18;
|
||||
const double _subtitleFontSize = 12;
|
||||
const double _actionGap = 8;
|
||||
const double _iconSize = 22;
|
||||
const double _backIconSize = 34;
|
||||
const double _iconWeight = 600;
|
||||
const double _borderWidth = 1;
|
||||
const double _backIconWeight = 400;
|
||||
const double _shadowBlur = 8;
|
||||
const Offset _lightShadowOffset = Offset(0, 2);
|
||||
|
||||
/// 二级页面统一圆形操作按钮,返回、分享和更多共用同一尺寸与表面样式。
|
||||
class AppSubpageCircleButton extends StatelessWidget {
|
||||
@@ -26,6 +26,8 @@ class AppSubpageCircleButton extends StatelessWidget {
|
||||
required this.tooltip,
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
this.iconSize = _iconSize,
|
||||
this.iconWeight = _iconWeight,
|
||||
this.dark = false,
|
||||
});
|
||||
|
||||
@@ -33,6 +35,8 @@ class AppSubpageCircleButton extends StatelessWidget {
|
||||
final String tooltip;
|
||||
final IconData icon;
|
||||
final VoidCallback onPressed;
|
||||
final double iconSize;
|
||||
final double iconWeight;
|
||||
final bool dark;
|
||||
|
||||
@override
|
||||
@@ -47,24 +51,18 @@ class AppSubpageCircleButton extends StatelessWidget {
|
||||
key: const Key('subpage-back-shadow'),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: dark ? AppColors.shadowSoft : AppColors.shadowSubtle,
|
||||
blurRadius: _shadowBlur,
|
||||
offset: dark ? Offset.zero : _lightShadowOffset,
|
||||
),
|
||||
],
|
||||
boxShadow: dark
|
||||
? const [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowSoft,
|
||||
blurRadius: _shadowBlur,
|
||||
),
|
||||
]
|
||||
: const [],
|
||||
),
|
||||
child: Material(
|
||||
color: dark ? AppColors.headerScrim : AppColors.card,
|
||||
shape: CircleBorder(
|
||||
side: dark
|
||||
? BorderSide.none
|
||||
: const BorderSide(
|
||||
color: AppColors.border,
|
||||
width: _borderWidth,
|
||||
),
|
||||
),
|
||||
color: dark ? AppColors.headerScrim : AppColors.transparent,
|
||||
shape: const CircleBorder(),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
@@ -72,9 +70,9 @@ class AppSubpageCircleButton extends StatelessWidget {
|
||||
child: Center(
|
||||
child: Icon(
|
||||
icon,
|
||||
color: AppColors.onSurface,
|
||||
size: _iconSize,
|
||||
weight: _iconWeight,
|
||||
color: dark ? AppColors.onSurface : AppColors.textPrimary,
|
||||
size: iconSize,
|
||||
weight: iconWeight,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -85,7 +83,7 @@ class AppSubpageCircleButton extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 二级页面统一返回按钮,浅色页使用白底描边,深色页使用半透明黑底。
|
||||
/// 二级页面统一返回按钮,普通页透明,沉浸页使用半透明黑底。
|
||||
class AppSubpageBackButton extends StatelessWidget {
|
||||
const AppSubpageBackButton({
|
||||
super.key,
|
||||
@@ -104,6 +102,8 @@ class AppSubpageBackButton extends StatelessWidget {
|
||||
buttonKey: backKey,
|
||||
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
|
||||
icon: Icons.chevron_left_rounded,
|
||||
iconSize: _backIconSize,
|
||||
iconWeight: _backIconWeight,
|
||||
dark: dark,
|
||||
onPressed: onBack ?? () => Navigator.of(context).maybePop(),
|
||||
);
|
||||
@@ -133,8 +133,8 @@ class AppSubpageHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final foreground = AppColors.onSurface;
|
||||
final secondary = AppColors.muted;
|
||||
final foreground = AppColors.textPrimary;
|
||||
final secondary = AppColors.textSecondary;
|
||||
return SizedBox(
|
||||
key: const Key('subpage-header'),
|
||||
height: subtitle == null ? _height : _heightWithSubtitle,
|
||||
|
||||