Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b90bd59b9 | ||
|
|
938435dfb9 | ||
|
|
b61bfe625c | ||
|
|
a7b4277536 | ||
|
|
dabff48f7c | ||
|
|
6acc00394b | ||
|
|
f3cfd0d0ec | ||
|
|
35cbdd2bd3 | ||
|
|
3ad371aa9d | ||
|
|
7463d3ee26 | ||
|
|
59fbd33059 | ||
|
|
8c1662475a | ||
|
|
7f65fe4d48 | ||
|
|
613147c20c | ||
|
|
731638b31b | ||
|
|
a833d62c50 | ||
|
|
bc01716449 | ||
|
|
12b1a11bd3 |
No files matched your search
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -2,18 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="350dp"
|
||||
android:startColor="#FF6B011A"
|
||||
android:centerColor="#616B011A"
|
||||
android:endColor="#006B011A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="350dp"
|
||||
android:startColor="#FF6B011A"
|
||||
android:centerColor="#616B011A"
|
||||
android:endColor="#006B011A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="350dp"
|
||||
android:startColor="#FF6B011A"
|
||||
android:centerColor="#616B011A"
|
||||
android:endColor="#006B011A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="350dp"
|
||||
android:startColor="#FF6B011A"
|
||||
android:centerColor="#616B011A"
|
||||
android:endColor="#006B011A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 12 KiB |
@@ -2,18 +2,6 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/splash_background" />
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="350dp"
|
||||
android:startColor="#FF6B011A"
|
||||
android:centerColor="#616B011A"
|
||||
android:endColor="#006B011A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 156 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 113 B |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 623 B |
@@ -3,5 +3,5 @@
|
||||
|
||||
<resources>
|
||||
<color name="splash_background">#000000</color>
|
||||
<color name="ic_launcher_background">#E9142E</color>
|
||||
</resources>
|
||||
<color name="ic_launcher_background">#000000</color>
|
||||
</resources>
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 734 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 734 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 822 B After Width: | Height: | Size: 361 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 799 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 799 B |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 655 KiB After Width: | Height: | Size: 20 KiB |
@@ -268,7 +268,9 @@ class _LumaDramaAppState extends State<LumaDramaApp> {
|
||||
CategoryController _createCategories() {
|
||||
final controller = CategoryController(_categoryRepository);
|
||||
if (widget.catalogRepository == null) {
|
||||
controller.dramaPageLoader = CategoryApi(_apiClient).dramas;
|
||||
final api = CategoryApi(_apiClient);
|
||||
controller.dramaPageLoader = api.dramas;
|
||||
controller.rankingLoader = api.ranking;
|
||||
}
|
||||
controller.load();
|
||||
return controller;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'drama.dart';
|
||||
import 'locale_text.dart';
|
||||
|
||||
/// 服务端推荐榜快照;顺序和排名均不可在客户端重算。
|
||||
class CategoryRanking {
|
||||
const CategoryRanking({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.revision,
|
||||
required this.entries,
|
||||
this.locales = const {},
|
||||
this.generatedAt,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String code;
|
||||
final String revision;
|
||||
final Map<String, String> locales;
|
||||
final DateTime? generatedAt;
|
||||
final List<CategoryRankingEntry> entries;
|
||||
|
||||
/// 解析 `GET /app/categories/{id}/ranking`。
|
||||
factory CategoryRanking.fromJson(Map<String, dynamic> json) {
|
||||
final rawList = json['list'];
|
||||
final entries = rawList is List
|
||||
? rawList
|
||||
.whereType<Map>()
|
||||
.map(
|
||||
(item) =>
|
||||
CategoryRankingEntry.fromJson(item.cast<String, dynamic>()),
|
||||
)
|
||||
.toList(growable: false)
|
||||
: const <CategoryRankingEntry>[];
|
||||
return CategoryRanking(
|
||||
id: (json['id'] ?? '').toString(),
|
||||
code: json['code'] as String? ?? '',
|
||||
revision: (json['revision'] ?? '1').toString(),
|
||||
locales: localeMap(json['locales']),
|
||||
generatedAt: DateTime.tryParse(json['generatedAt'] as String? ?? ''),
|
||||
entries: entries,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 推荐榜中的一部短剧及其服务端排名。
|
||||
class CategoryRankingEntry {
|
||||
const CategoryRankingEntry({required this.rank, required this.drama});
|
||||
|
||||
final int rank;
|
||||
final Drama drama;
|
||||
|
||||
factory CategoryRankingEntry.fromJson(Map<String, dynamic> json) {
|
||||
final rawDrama = json['drama'];
|
||||
return CategoryRankingEntry(
|
||||
rank: (json['rank'] as num?)?.toInt() ?? 0,
|
||||
drama: Drama.fromCardJson(
|
||||
rawDrama is Map<String, dynamic>
|
||||
? rawDrama
|
||||
: rawDrama is Map
|
||||
? rawDrama.cast<String, dynamic>()
|
||||
: const <String, dynamic>{},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,19 @@ class ContentCategory {
|
||||
const ContentCategory({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.code = '',
|
||||
this.layoutType = gridLayout,
|
||||
this.revision = '1',
|
||||
this.locales = const {},
|
||||
});
|
||||
|
||||
static const String gridLayout = 'GRID';
|
||||
static const String rankingLayout = 'RANKING';
|
||||
|
||||
final String id;
|
||||
final String code;
|
||||
final String layoutType;
|
||||
final String revision;
|
||||
|
||||
/// 中文名称,与 locales 里的 zh 相同。
|
||||
final String name;
|
||||
@@ -20,9 +29,18 @@ class ContentCategory {
|
||||
factory ContentCategory.fromJson(Map<String, dynamic> json) {
|
||||
final locales = localeMap(json['locales']);
|
||||
final name = json['name'] as String? ?? locales['zh'] ?? '';
|
||||
return ContentCategory(id: (json['id'] ?? '').toString(), name: name, locales: locales);
|
||||
return ContentCategory(
|
||||
id: (json['id'] ?? '').toString(),
|
||||
name: name,
|
||||
code: json['code'] as String? ?? '',
|
||||
layoutType: json['layoutType'] as String? ?? gridLayout,
|
||||
revision: (json['revision'] ?? '1').toString(),
|
||||
locales: locales,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isRanking => layoutType == rankingLayout;
|
||||
|
||||
/// 按界面语言取名称。缺对应语言时回落到中文。
|
||||
String localizedName(String languageCode) {
|
||||
return localizedText(languageCode, name, locales);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import '../models/content_category.dart';
|
||||
import '../models/category_ranking.dart';
|
||||
import '../models/drama.dart';
|
||||
import '../models/page_result.dart';
|
||||
import 'api_client.dart';
|
||||
@@ -30,11 +31,14 @@ class CategoryApi {
|
||||
}) async {
|
||||
final data = await _client.get(
|
||||
'/app/categories/$categoryId/dramas',
|
||||
query: {
|
||||
'pageIndex': '$pageIndex',
|
||||
'pageSize': '$pageSize',
|
||||
},
|
||||
query: {'pageIndex': '$pageIndex', 'pageSize': '$pageSize'},
|
||||
);
|
||||
return PageResult.parse(data, Drama.fromCardJson);
|
||||
}
|
||||
|
||||
/// 推荐榜快照,服务端已确定内容顺序和连续排名。
|
||||
Future<CategoryRanking> ranking(String categoryId) async {
|
||||
final data = await _client.get('/app/categories/$categoryId/ranking');
|
||||
return CategoryRanking.fromJson(ResponseDecoders.asMap(data));
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../../config/app_config.dart';
|
||||
import '../models/content_category.dart';
|
||||
import '../models/category_ranking.dart';
|
||||
import '../models/drama.dart';
|
||||
import '../models/home_feed.dart';
|
||||
import '../models/page_result.dart';
|
||||
@@ -21,10 +22,15 @@ class CategoryController extends ChangeNotifier {
|
||||
String categoryId, {
|
||||
int pageIndex,
|
||||
int pageSize,
|
||||
})? dramaPageLoader;
|
||||
})?
|
||||
dramaPageLoader;
|
||||
|
||||
/// 生产环境推荐榜加载器,测试与本地数据模式可不注入。
|
||||
Future<CategoryRanking> Function(String categoryId)? rankingLoader;
|
||||
|
||||
List<ContentCategory> categories = const [];
|
||||
final Map<String, CategoryDramaSlot> _slots = {};
|
||||
final Map<String, CategoryRankingSlot> _rankingSlots = {};
|
||||
HomeFeed feed = const HomeFeed();
|
||||
bool loading = false;
|
||||
String? error;
|
||||
@@ -36,6 +42,29 @@ class CategoryController extends ChangeNotifier {
|
||||
return _slots.putIfAbsent(categoryId, CategoryDramaSlot.new);
|
||||
}
|
||||
|
||||
CategoryRankingSlot rankingSlotOf(String categoryId) {
|
||||
return _rankingSlots.putIfAbsent(categoryId, CategoryRankingSlot.new);
|
||||
}
|
||||
|
||||
/// 打开推荐榜并获取当前服务端快照。
|
||||
Future<void> openRanking(String categoryId) async {
|
||||
final loader = rankingLoader;
|
||||
if (loader == null) return;
|
||||
final slot = rankingSlotOf(categoryId);
|
||||
slot.loading = true;
|
||||
slot.error = null;
|
||||
_notify();
|
||||
try {
|
||||
slot.ranking = await loader(categoryId);
|
||||
} catch (exception) {
|
||||
slot.error = exception;
|
||||
if (kDebugMode) debugPrint('[category-ranking] $exception');
|
||||
} finally {
|
||||
slot.loading = false;
|
||||
_notify();
|
||||
}
|
||||
}
|
||||
|
||||
/// 打开分类并加载第一页短剧。
|
||||
Future<void> openCategory(String categoryId) async {
|
||||
final loader = dramaPageLoader;
|
||||
@@ -126,8 +155,14 @@ class CategoryController extends ChangeNotifier {
|
||||
loading = false;
|
||||
_notify();
|
||||
}
|
||||
if (error == null && dramaPageLoader != null && categories.isNotEmpty) {
|
||||
await openCategory(categories.first.id);
|
||||
final hasRemoteLoader = dramaPageLoader != null || rankingLoader != null;
|
||||
if (error == null && hasRemoteLoader && categories.isNotEmpty) {
|
||||
final first = categories.first;
|
||||
if (first.isRanking) {
|
||||
await openRanking(first.id);
|
||||
} else {
|
||||
await openCategory(first.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,3 +187,10 @@ class CategoryDramaSlot {
|
||||
|
||||
bool get hasMore => dramas.length < total;
|
||||
}
|
||||
|
||||
/// 单个推荐榜的快照状态。
|
||||
class CategoryRankingSlot {
|
||||
CategoryRanking? ranking;
|
||||
Object? error;
|
||||
bool loading = false;
|
||||
}
|
||||
@@ -120,7 +120,9 @@ class DownloadController extends ChangeNotifier {
|
||||
String episodeId, {
|
||||
DownloadLicense? license,
|
||||
}) async {
|
||||
if (_downloading.contains(episodeId)) return const DownloadActionResult(ok: true);
|
||||
if (_downloading.contains(episodeId)) {
|
||||
return const DownloadActionResult(ok: true);
|
||||
}
|
||||
final source = license ?? _licenseFor(episodeId);
|
||||
if (source == null) return const DownloadActionResult(ok: false);
|
||||
_beginDownload(episodeId);
|
||||
@@ -129,7 +131,8 @@ class DownloadController extends ChangeNotifier {
|
||||
final media = await _storage.download(
|
||||
episodeId: episodeId,
|
||||
url: resolved,
|
||||
onProgress: (received, total) => _onProgress(episodeId, received, total),
|
||||
onProgress: (received, total) =>
|
||||
_onProgress(episodeId, received, total),
|
||||
);
|
||||
_localPaths[episodeId] = media.filePath;
|
||||
_progress[episodeId] = 1;
|
||||
|
||||
@@ -30,6 +30,12 @@ abstract final class AppColors {
|
||||
/// 首页及剧集播放页视频信息文案:参考设计图的 65% 半透明白。
|
||||
static const homeFeedVideoCopy = Color(0xA6FFFFFF);
|
||||
|
||||
/// 首页观看全集按钮:与浮层玻璃语言一致的半透明白表面。
|
||||
static const watchAllSurface = Color(0x26FFFFFF);
|
||||
|
||||
/// 观看全集按钮的极淡白色轮廓。
|
||||
static const watchAllBorder = Color(0x0FFFFFFF);
|
||||
|
||||
/// 主操作、选中态、播放进度。旧品牌橙已全量映射为品牌红(2026-10 改版)。
|
||||
static const blue = Color(0xFFF04E4E);
|
||||
static const primary = blue;
|
||||
|
||||
@@ -157,17 +157,9 @@ abstract final class AppDimens {
|
||||
/// 首页热播榜。
|
||||
static const double rankingHeroTitle = 22;
|
||||
static const double rankingHeroSubtitle = 11;
|
||||
static const double rankingPodiumChampionWidth = 110;
|
||||
static const double rankingPodiumChampionHeight = 146;
|
||||
static const double rankingPodiumWidth = 92;
|
||||
static const double rankingPodiumHeight = 122;
|
||||
static const double rankingPodiumRadius = 10;
|
||||
static const double rankingRowHeight = 96;
|
||||
static const double rankingNumberWidth = 56;
|
||||
static const double rankingNumberFont = 48;
|
||||
static const double rankingCoverWidth = 60;
|
||||
static const double rankingCoverHeight = 80;
|
||||
static const double rankingCoverRadius = 6;
|
||||
static const double rankingCardCoverWidth = 96;
|
||||
static const double rankingCardCoverHeight = 128;
|
||||
|
||||
/// 全部短剧筛选与追剧双列。
|
||||
static const double filterChipFont = 16;
|
||||
|
||||
@@ -18,6 +18,7 @@ class AppBottomNavItem {
|
||||
this.selected = false,
|
||||
this.assetPath,
|
||||
this.selectedAssetPath,
|
||||
this.customIcon,
|
||||
});
|
||||
|
||||
final Key tabKey;
|
||||
@@ -25,6 +26,7 @@ class AppBottomNavItem {
|
||||
final IconData selectedIcon;
|
||||
final String? assetPath;
|
||||
final String? selectedAssetPath;
|
||||
final Widget? customIcon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
@@ -93,26 +95,31 @@ class _NavDestination extends StatelessWidget {
|
||||
duration: const Duration(milliseconds: 160),
|
||||
curve: Curves.easeOut,
|
||||
scale: item.selected ? 1 : 0.96,
|
||||
child: assetPath == null
|
||||
? Icon(
|
||||
fallbackIcon,
|
||||
size: AppDimens.navIcon,
|
||||
color: color,
|
||||
)
|
||||
: ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(color, BlendMode.srcIn),
|
||||
child: Image.asset(
|
||||
assetPath,
|
||||
width: AppDimens.navIcon,
|
||||
height: AppDimens.navIcon,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (_, _, _) => Icon(
|
||||
child:
|
||||
item.customIcon ??
|
||||
(assetPath == null
|
||||
? Icon(
|
||||
fallbackIcon,
|
||||
size: AppDimens.navIcon,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
color,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
child: Image.asset(
|
||||
assetPath,
|
||||
width: AppDimens.navIcon,
|
||||
height: AppDimens.navIcon,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (_, _, _) => Icon(
|
||||
fallbackIcon,
|
||||
size: AppDimens.navIcon,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
const SizedBox(height: AppDimens.navLabelGap),
|
||||
Text(
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_dimens.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'app_bottom_nav.dart';
|
||||
import 'root_nav_glyph.dart';
|
||||
|
||||
/// 客户端根导航的固定顺序。
|
||||
enum AppRootTab {
|
||||
@@ -16,6 +18,13 @@ enum AppRootTab {
|
||||
}
|
||||
|
||||
extension AppRootTabUi on AppRootTab {
|
||||
RootNavGlyphKind get glyphKind => switch (this) {
|
||||
AppRootTab.home => RootNavGlyphKind.home,
|
||||
AppRootTab.recommend => RootNavGlyphKind.recommend,
|
||||
AppRootTab.following => RootNavGlyphKind.following,
|
||||
AppRootTab.mine => RootNavGlyphKind.mine,
|
||||
};
|
||||
|
||||
Key get tabKey => switch (this) {
|
||||
AppRootTab.home => const Key('tab-home'),
|
||||
AppRootTab.recommend => const Key('tab-recommend'),
|
||||
@@ -71,6 +80,11 @@ class AppRootBottomNav extends StatelessWidget {
|
||||
selectedIcon: tab.selectedIcon,
|
||||
label: tab.label(l10n),
|
||||
selected: tab == selected,
|
||||
customIcon: RootNavGlyph(
|
||||
kind: tab.glyphKind,
|
||||
selected: tab == selected,
|
||||
size: AppDimens.navIcon,
|
||||
),
|
||||
onTap: () => onSelected(tab),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,12 +5,12 @@ import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_dimens.dart';
|
||||
|
||||
const double _regularIconSize = 72;
|
||||
const double _compactIconSize = 44;
|
||||
const double _iconSize = 72;
|
||||
const double _maxContentWidth = 260;
|
||||
const double _regularHorizontal = 24;
|
||||
const double _regularVertical = 28;
|
||||
const double _compactPad = 16;
|
||||
const double _compactHorizontal = 16;
|
||||
const double _compactVertical = 4;
|
||||
const double _regularGap = 20;
|
||||
const double _compactGap = 12;
|
||||
const double _actionMinHeight = 44;
|
||||
@@ -27,6 +27,7 @@ class EmptyState extends StatelessWidget {
|
||||
this.onAction,
|
||||
this.footer,
|
||||
this.compact = false,
|
||||
this.stretchContent = false,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
@@ -38,6 +39,9 @@ class EmptyState extends StatelessWidget {
|
||||
final Widget? footer;
|
||||
final bool compact;
|
||||
|
||||
/// 让图标和文案占满内容宽度,适用于需要严格居中的宽版空状态。
|
||||
final bool stretchContent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasAction = actionLabel != null && onAction != null;
|
||||
@@ -48,28 +52,33 @@ class EmptyState extends StatelessWidget {
|
||||
child: Padding(
|
||||
key: const Key('empty-state-padding'),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: compact ? _compactPad : _regularHorizontal,
|
||||
vertical: compact ? _compactPad : _regularVertical,
|
||||
horizontal: compact ? _compactHorizontal : _regularHorizontal,
|
||||
vertical: compact ? _compactVertical : _regularVertical,
|
||||
),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
label: title,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ExcludeSemantics(
|
||||
child: _EmptyMark(icon: icon, compact: compact),
|
||||
),
|
||||
SizedBox(height: compact ? _compactGap : _regularGap),
|
||||
_EmptyCopy(
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
actionLabel: hasAction ? actionLabel : null,
|
||||
actionKey: actionKey,
|
||||
onAction: hasAction ? onAction : null,
|
||||
footer: footer,
|
||||
),
|
||||
],
|
||||
child: SizedBox(
|
||||
width: stretchContent ? double.infinity : null,
|
||||
child: Semantics(
|
||||
container: true,
|
||||
label: title,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ExcludeSemantics(child: _EmptyMark(icon: icon)),
|
||||
SizedBox(height: compact ? _compactGap : _regularGap),
|
||||
SizedBox(
|
||||
width: stretchContent ? double.infinity : null,
|
||||
child: _EmptyCopy(
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
actionLabel: hasAction ? actionLabel : null,
|
||||
actionKey: actionKey,
|
||||
onAction: hasAction ? onAction : null,
|
||||
footer: footer,
|
||||
stretchContent: stretchContent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -80,17 +89,16 @@ class EmptyState extends StatelessWidget {
|
||||
|
||||
/// 空列表只放一枚大图标,不画线框,也不铺底色。
|
||||
class _EmptyMark extends StatelessWidget {
|
||||
const _EmptyMark({required this.icon, required this.compact});
|
||||
const _EmptyMark({required this.icon});
|
||||
|
||||
final IconData icon;
|
||||
final bool compact;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
icon,
|
||||
key: const Key('empty-state-icon'),
|
||||
size: compact ? _compactIconSize : _regularIconSize,
|
||||
size: _iconSize,
|
||||
color: AppColors.subtle,
|
||||
);
|
||||
}
|
||||
@@ -104,6 +112,7 @@ class _EmptyCopy extends StatelessWidget {
|
||||
required this.actionKey,
|
||||
required this.onAction,
|
||||
required this.footer,
|
||||
required this.stretchContent,
|
||||
});
|
||||
|
||||
final String title;
|
||||
@@ -112,11 +121,15 @@ class _EmptyCopy extends StatelessWidget {
|
||||
final Key? actionKey;
|
||||
final VoidCallback? onAction;
|
||||
final Widget? footer;
|
||||
final bool stretchContent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: stretchContent
|
||||
? CrossAxisAlignment.stretch
|
||||
: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ExcludeSemantics(
|
||||
child: Text(
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// Author: fruit.com.cn
|
||||
// 职责:给默认图片加载占位叠加可暂停、局部重绘的轻量扫光。
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const _sweepDuration = Duration(milliseconds: 1400);
|
||||
const double _bandWidthRatio = 0.65;
|
||||
const _highlight = Color(0x12FFFFFF);
|
||||
const _clear = Color(0x00FFFFFF);
|
||||
|
||||
/// 只用于等待真实图片的占位;减少动画或页面离屏时不运行扫光。
|
||||
class ImagePlaceholderShimmer extends StatefulWidget {
|
||||
/// 在 [child] 上方绘制不影响布局与点击区域的扫光。
|
||||
const ImagePlaceholderShimmer({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<ImagePlaceholderShimmer> createState() =>
|
||||
_ImagePlaceholderShimmerState();
|
||||
}
|
||||
|
||||
class _ImagePlaceholderShimmerState extends State<ImagePlaceholderShimmer>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final AnimationController _controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: _sweepDuration,
|
||||
);
|
||||
bool _active = false;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_active =
|
||||
TickerMode.valuesOf(context).enabled &&
|
||||
!MediaQuery.disableAnimationsOf(context);
|
||||
if (_active) {
|
||||
_controller.repeat();
|
||||
} else {
|
||||
_controller.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_active) return widget.child;
|
||||
return RepaintBoundary(
|
||||
child: ClipRect(
|
||||
child: CustomPaint(
|
||||
foregroundPainter: _SweepPainter(_controller),
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SweepPainter extends CustomPainter {
|
||||
_SweepPainter(this.progress) : super(repaint: progress);
|
||||
|
||||
final Animation<double> progress;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
if (size.isEmpty) return;
|
||||
final bandWidth = size.width * _bandWidthRatio;
|
||||
final left = -bandWidth + (size.width + bandWidth) * progress.value;
|
||||
final rect = Rect.fromLTWH(left, 0, bandWidth, size.height);
|
||||
final paint = Paint()
|
||||
..shader = const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [_clear, _highlight, _clear],
|
||||
).createShader(rect);
|
||||
canvas.drawRect(rect, paint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant _SweepPainter oldDelegate) =>
|
||||
oldDelegate.progress != progress;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
// Author: fruit.com.cn
|
||||
// 职责:统一网络图片入口,补服务地址,并在加载中/失败时显示纯色占位块。
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../config/app_config.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import 'image_placeholder_shimmer.dart';
|
||||
|
||||
const int _minImageDecodePixels = 96;
|
||||
const int _maxImageDecodePixels = 2048;
|
||||
@@ -32,8 +32,6 @@ class RemoteImage extends StatelessWidget {
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit = BoxFit.cover,
|
||||
this.showFallbackIcon = false,
|
||||
this.fallbackIconKey,
|
||||
this.fallbackAspectRatio,
|
||||
this.fallbackColor = AppColors.raised,
|
||||
this.fallbackWidget,
|
||||
@@ -45,12 +43,10 @@ class RemoteImage extends StatelessWidget {
|
||||
final double? width;
|
||||
final double? height;
|
||||
final BoxFit fit;
|
||||
final bool showFallbackIcon;
|
||||
final Key? fallbackIconKey;
|
||||
final double? fallbackAspectRatio;
|
||||
final Color fallbackColor;
|
||||
|
||||
/// 自定义兜底:地址为空、加载中、加载失败时都显示它(优先于 [fallbackColor])。
|
||||
/// 自定义占位:地址为空、加载中、加载失败时都显示它(优先于 [fallbackColor])。
|
||||
final Widget? fallbackWidget;
|
||||
final int? decodeWidth;
|
||||
final int? decodeHeight;
|
||||
@@ -58,7 +54,7 @@ class RemoteImage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final url = AppConfig.mediaUrl(path);
|
||||
if (url.isEmpty) return _fallback(brand: showFallbackIcon);
|
||||
if (url.isEmpty) return _fallback();
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final pixelRatio = MediaQuery.devicePixelRatioOf(context);
|
||||
@@ -100,51 +96,23 @@ class RemoteImage extends StatelessWidget {
|
||||
?.clamp(_minImageDecodePixels, _maxImageDecodePixels)
|
||||
.toInt(),
|
||||
gaplessPlayback: true,
|
||||
errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon),
|
||||
errorBuilder: (_, _, _) => _fallback(),
|
||||
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
||||
if (wasSynchronouslyLoaded || frame != null) return child;
|
||||
return _loadingFallback();
|
||||
return _fallback();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _loadingFallback() {
|
||||
Widget _fallback() {
|
||||
final custom = fallbackWidget;
|
||||
if (custom != null) return custom;
|
||||
return ImagePlaceholderShimmer(child: _fallback(brand: showFallbackIcon));
|
||||
}
|
||||
|
||||
Widget _fallback({required bool brand}) {
|
||||
final custom = fallbackWidget;
|
||||
if (custom != null) return custom;
|
||||
final mark = brand
|
||||
? LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth.isFinite
|
||||
? constraints.maxWidth
|
||||
: 120.0;
|
||||
return Center(
|
||||
child: Image.asset(
|
||||
'assets/icon/splash_logo.png',
|
||||
key: fallbackIconKey,
|
||||
width: width * 0.72,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: null;
|
||||
final fallback = Container(
|
||||
width: width,
|
||||
height: height,
|
||||
color: brand ? AppColors.mediaBlack : fallbackColor,
|
||||
alignment: Alignment.center,
|
||||
child: mark,
|
||||
);
|
||||
final content = custom != null
|
||||
? SizedBox(width: width, height: height, child: custom)
|
||||
: Container(width: width, height: height, color: fallbackColor);
|
||||
final ratio = fallbackAspectRatio;
|
||||
if (ratio == null) return fallback;
|
||||
return AspectRatio(aspectRatio: ratio, child: fallback);
|
||||
if (ratio == null) return content;
|
||||
return AspectRatio(aspectRatio: ratio, child: content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Author: fruit.com.cn
|
||||
// 职责:绘制根导航使用的饱满品牌插画图标。
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_colors.dart';
|
||||
|
||||
const double _designSize = 30;
|
||||
|
||||
/// 根导航四个入口对应的图标种类。
|
||||
enum RootNavGlyphKind { home, recommend, following, mine }
|
||||
|
||||
/// 根导航插画图标,根据选中态使用品牌红和中性灰白配色。
|
||||
class RootNavGlyph extends StatelessWidget {
|
||||
const RootNavGlyph({
|
||||
super.key,
|
||||
required this.kind,
|
||||
required this.selected,
|
||||
required this.size,
|
||||
});
|
||||
|
||||
final RootNavGlyphKind kind;
|
||||
final bool selected;
|
||||
final double size;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomPaint(
|
||||
size: Size.square(size),
|
||||
painter: _RootNavGlyphPainter(kind: kind, selected: selected),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RootNavGlyphPainter extends CustomPainter {
|
||||
const _RootNavGlyphPainter({required this.kind, required this.selected});
|
||||
|
||||
final RootNavGlyphKind kind;
|
||||
final bool selected;
|
||||
|
||||
Color get _main => selected ? AppColors.navSelected : const Color(0xFFD0D0D2);
|
||||
Color get _light => selected ? AppColors.homeCrownGold : Colors.white;
|
||||
Color get _shade =>
|
||||
selected ? const Color(0xFF9F2935) : const Color(0xFF858589);
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
canvas.save();
|
||||
canvas.scale(size.width / _designSize);
|
||||
switch (kind) {
|
||||
case RootNavGlyphKind.home:
|
||||
_paintHome(canvas);
|
||||
case RootNavGlyphKind.recommend:
|
||||
_paintRecommend(canvas);
|
||||
case RootNavGlyphKind.following:
|
||||
_paintFollowing(canvas);
|
||||
case RootNavGlyphKind.mine:
|
||||
_paintMine(canvas);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
void _paintHome(Canvas canvas) {
|
||||
final roof = Path()
|
||||
..moveTo(3, 13)
|
||||
..lineTo(15, 3)
|
||||
..lineTo(27, 13)
|
||||
..lineTo(24, 16)
|
||||
..lineTo(15, 8.5)
|
||||
..lineTo(6, 16)
|
||||
..close();
|
||||
canvas.drawShadow(roof, AppColors.shadow, 2, false);
|
||||
canvas.drawPath(roof, _gradient(const Rect.fromLTWH(3, 3, 24, 13)));
|
||||
final body = RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(6, 13, 24, 27),
|
||||
const Radius.circular(3),
|
||||
);
|
||||
canvas.drawRRect(body, _gradient(const Rect.fromLTWH(6, 13, 18, 14)));
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(12, 18, 18, 27),
|
||||
const Radius.circular(2),
|
||||
),
|
||||
Paint()..color = _shade,
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(8, 16, 11, 19),
|
||||
const Radius.circular(1),
|
||||
),
|
||||
Paint()..color = _light,
|
||||
);
|
||||
}
|
||||
|
||||
void _paintRecommend(Canvas canvas) {
|
||||
final body = RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(6, 4, 24, 27),
|
||||
const Radius.circular(5),
|
||||
);
|
||||
canvas.drawShadow(Path()..addRRect(body), AppColors.shadow, 2, false);
|
||||
canvas.drawRRect(body, _gradient(const Rect.fromLTWH(6, 4, 18, 23)));
|
||||
for (var index = 0; index < 3; index++) {
|
||||
final left = 9.0 + index * 5;
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(left, 7, 3, 2.5),
|
||||
const Radius.circular(1),
|
||||
),
|
||||
Paint()..color = _light,
|
||||
);
|
||||
}
|
||||
final play = Path()
|
||||
..moveTo(12, 13)
|
||||
..quadraticBezierTo(12, 11.5, 13.5, 12.3)
|
||||
..lineTo(19.5, 15.7)
|
||||
..quadraticBezierTo(21, 16.5, 19.5, 17.3)
|
||||
..lineTo(13.5, 20.7)
|
||||
..quadraticBezierTo(12, 21.5, 12, 20)
|
||||
..close();
|
||||
canvas.drawPath(play, Paint()..color = _light);
|
||||
}
|
||||
|
||||
void _paintFollowing(Canvas canvas) {
|
||||
final page = RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(5, 4, 25, 27),
|
||||
const Radius.circular(4),
|
||||
);
|
||||
canvas.drawShadow(Path()..addRRect(page), AppColors.shadow, 2, false);
|
||||
canvas.drawRRect(page, _gradient(const Rect.fromLTWH(5, 4, 20, 23)));
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(8, 9, 17, 10.5),
|
||||
const Radius.circular(0.7),
|
||||
),
|
||||
Paint()..color = _light,
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
const Rect.fromLTRB(8, 13, 16, 14.5),
|
||||
const Radius.circular(0.7),
|
||||
),
|
||||
Paint()..color = _light,
|
||||
);
|
||||
final bookmark = Path()
|
||||
..moveTo(18, 7)
|
||||
..lineTo(22, 7)
|
||||
..lineTo(22, 20)
|
||||
..lineTo(20, 18)
|
||||
..lineTo(18, 20)
|
||||
..close();
|
||||
canvas.drawPath(bookmark, Paint()..color = _light);
|
||||
}
|
||||
|
||||
void _paintMine(Canvas canvas) {
|
||||
final bounds = Rect.fromCircle(center: const Offset(15, 15), radius: 13);
|
||||
canvas.drawShadow(Path()..addOval(bounds), AppColors.shadow, 2, false);
|
||||
canvas.drawCircle(const Offset(15, 15), 13, _gradient(bounds));
|
||||
canvas.drawCircle(const Offset(15, 11), 4, Paint()..color = _light);
|
||||
final shoulders = Path()
|
||||
..moveTo(7, 24)
|
||||
..cubicTo(7.5, 19, 10.5, 17, 15, 17)
|
||||
..cubicTo(19.5, 17, 22.5, 19, 23, 24)
|
||||
..quadraticBezierTo(15, 29, 7, 24)
|
||||
..close();
|
||||
canvas.drawPath(shoulders, Paint()..color = _light);
|
||||
canvas.drawCircle(const Offset(13.5, 11), 0.55, Paint()..color = _shade);
|
||||
canvas.drawCircle(const Offset(16.5, 11), 0.55, Paint()..color = _shade);
|
||||
}
|
||||
|
||||
Paint _gradient(Rect bounds) => Paint()
|
||||
..shader = LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [_light, _main, _shade],
|
||||
).createShader(bounds);
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant _RootNavGlyphPainter oldDelegate) =>
|
||||
oldDelegate.kind != kind || oldDelegate.selected != selected;
|
||||
}
|
||||
@@ -83,6 +83,12 @@
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"likesLabel": "{count} likes",
|
||||
"@likesLabel": {
|
||||
"placeholders": {
|
||||
"count": {"type": "String"}
|
||||
}
|
||||
},
|
||||
"topCharts": "Hot Ranking",
|
||||
"newReleases": "New Releases",
|
||||
"newDramas": "New",
|
||||
@@ -359,7 +365,7 @@
|
||||
"categoriesError": "Categories could not be loaded.",
|
||||
"detailError": "The episode list could not be loaded.",
|
||||
"noMediaNotice": "This episode has no playable media yet.",
|
||||
"noStories": "No stories available yet.",
|
||||
"noStories": "No stories available yet",
|
||||
"notices": "Notices",
|
||||
"noNotices": "No notices yet.",
|
||||
"noticesLoadFailed": "Notices could not be loaded.",
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
"authorNoteLabel": "Catatan penulis",
|
||||
"reserve": "Reservasi",
|
||||
"heatLabel": "{count} panas",
|
||||
"likesLabel": "{count} suka",
|
||||
"topCharts": "Peringkat Populer",
|
||||
"newReleases": "Rilisan Baru",
|
||||
"newDramas": "Baru",
|
||||
@@ -338,7 +339,7 @@
|
||||
"categoriesError": "Kategori gagal dimuat.",
|
||||
"detailError": "Daftar episode gagal dimuat.",
|
||||
"noMediaNotice": "Episode ini belum punya media yang bisa diputar.",
|
||||
"noStories": "Belum ada cerita.",
|
||||
"noStories": "Belum ada cerita",
|
||||
"notices": "Notifikasi",
|
||||
"noNotices": "Belum ada notifikasi.",
|
||||
"noticesLoadFailed": "Notifikasi tidak dapat dimuat.",
|
||||
|
||||
@@ -442,6 +442,12 @@ abstract class AppLocalizations {
|
||||
/// **'{count} heat'**
|
||||
String heatLabel(String count);
|
||||
|
||||
/// No description provided for @likesLabel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{count} likes'**
|
||||
String likesLabel(String count);
|
||||
|
||||
/// No description provided for @topCharts.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -1393,7 +1399,7 @@ abstract class AppLocalizations {
|
||||
/// No description provided for @noStories.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No stories available yet.'**
|
||||
/// **'No stories available yet'**
|
||||
String get noStories;
|
||||
|
||||
/// No description provided for @notices.
|
||||
|
||||
@@ -191,6 +191,11 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
return '$count heat';
|
||||
}
|
||||
|
||||
@override
|
||||
String likesLabel(String count) {
|
||||
return '$count likes';
|
||||
}
|
||||
|
||||
@override
|
||||
String get topCharts => 'Hot Ranking';
|
||||
|
||||
@@ -709,7 +714,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
String get noMediaNotice => 'This episode has no playable media yet.';
|
||||
|
||||
@override
|
||||
String get noStories => 'No stories available yet.';
|
||||
String get noStories => 'No stories available yet';
|
||||
|
||||
@override
|
||||
String get notices => 'Notices';
|
||||
|
||||
@@ -191,6 +191,11 @@ class AppLocalizationsId extends AppLocalizations {
|
||||
return '$count panas';
|
||||
}
|
||||
|
||||
@override
|
||||
String likesLabel(String count) {
|
||||
return '$count suka';
|
||||
}
|
||||
|
||||
@override
|
||||
String get topCharts => 'Peringkat Populer';
|
||||
|
||||
@@ -712,7 +717,7 @@ class AppLocalizationsId extends AppLocalizations {
|
||||
'Episode ini belum punya media yang bisa diputar.';
|
||||
|
||||
@override
|
||||
String get noStories => 'Belum ada cerita.';
|
||||
String get noStories => 'Belum ada cerita';
|
||||
|
||||
@override
|
||||
String get notices => 'Notifikasi';
|
||||
|
||||
@@ -189,6 +189,11 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
return '$count热度';
|
||||
}
|
||||
|
||||
@override
|
||||
String likesLabel(String count) {
|
||||
return '$count次点赞';
|
||||
}
|
||||
|
||||
@override
|
||||
String get topCharts => '热播榜';
|
||||
|
||||
@@ -702,7 +707,7 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
String get noMediaNotice => '该剧集还没有可播放的片源。';
|
||||
|
||||
@override
|
||||
String get noStories => '暂无剧目。';
|
||||
String get noStories => '暂无剧目';
|
||||
|
||||
@override
|
||||
String get notices => '通知';
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
"authorNoteLabel": "作者声明",
|
||||
"reserve": "预约",
|
||||
"heatLabel": "{count}热度",
|
||||
"likesLabel": "{count}次点赞",
|
||||
"topCharts": "热播榜",
|
||||
"newReleases": "新剧",
|
||||
"newDramas": "新剧",
|
||||
@@ -300,7 +301,7 @@
|
||||
"categoriesError": "分类加载失败。",
|
||||
"detailError": "剧集信息加载失败。",
|
||||
"noMediaNotice": "该剧集还没有可播放的片源。",
|
||||
"noStories": "暂无剧目。",
|
||||
"noStories": "暂无剧目",
|
||||
"notices": "通知",
|
||||
"noNotices": "暂无通知。",
|
||||
"noticesLoadFailed": "通知加载失败,请重试。",
|
||||
|
||||
@@ -297,6 +297,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
icon: Icons.movie_filter_outlined,
|
||||
title: l10n.noStories,
|
||||
subtitle: l10n.emptyHint,
|
||||
stretchContent: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -176,7 +176,7 @@ class _FeedBannerCarouselState extends State<FeedBannerCarousel> {
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
RemoteImage(banner.imageUrl, showFallbackIcon: true),
|
||||
RemoteImage(banner.imageUrl),
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
|
||||
@@ -37,7 +37,6 @@ class SearchResultCard extends StatelessWidget {
|
||||
RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
const Positioned(
|
||||
@@ -60,7 +59,9 @@ class SearchResultCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppDimens.searchResultTitleGap),
|
||||
Text(
|
||||
drama.localizedTitle(Localizations.localeOf(context).languageCode),
|
||||
drama.localizedTitle(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
),
|
||||
key: Key('search-result-title-${drama.id}'),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -93,7 +94,9 @@ class SearchResultCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<String> _tags(BuildContext context) {
|
||||
final localized = drama.localizedTypeLabels(Localizations.localeOf(context).languageCode);
|
||||
final localized = drama.localizedTypeLabels(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
if (localized.isNotEmpty) return localized.take(3).toList(growable: false);
|
||||
final seen = <String>{};
|
||||
return [drama.genre, drama.category]
|
||||
|
||||
@@ -126,7 +126,6 @@ class DramaDetailHeader extends StatelessWidget {
|
||||
child: RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackAspectRatio: 3 / 4,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -38,7 +38,6 @@ const double _synopsisFontSize = 12;
|
||||
const double _synopsisLineHeight = 1.15;
|
||||
const double _synopsisGap = 4;
|
||||
const int _maxTags = 2;
|
||||
const double _emptyListHeight = 360;
|
||||
const double _loadMoreThreshold = 240;
|
||||
|
||||
final RegExp _tagSplitter = RegExp(r'[,/、·]');
|
||||
@@ -124,37 +123,29 @@ class _FavoritesBody extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
if (favorites.error != null && favorites.cards.isEmpty) {
|
||||
return _refreshable(
|
||||
return _refreshableState(
|
||||
favorites,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _emptyListHeight,
|
||||
child: EmptyState(
|
||||
key: const Key('favorites-error'),
|
||||
icon: Icons.cloud_off_rounded,
|
||||
title: errorText(l10n, favorites.error, l10n.favoritesError),
|
||||
actionLabel: l10n.retry,
|
||||
actionKey: const Key('favorites-retry'),
|
||||
onAction: () => unawaited(favorites.load()),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: EmptyState(
|
||||
key: const Key('favorites-error'),
|
||||
icon: Icons.cloud_off_rounded,
|
||||
title: errorText(l10n, favorites.error, l10n.favoritesError),
|
||||
actionLabel: l10n.retry,
|
||||
actionKey: const Key('favorites-retry'),
|
||||
onAction: () => unawaited(favorites.load()),
|
||||
stretchContent: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (favorites.cards.isEmpty) {
|
||||
return _refreshable(
|
||||
return _refreshableState(
|
||||
favorites,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _emptyListHeight,
|
||||
child: EmptyState(
|
||||
key: const Key('favorites-empty'),
|
||||
icon: Icons.star_border_rounded,
|
||||
title: l10n.noFavorites,
|
||||
subtitle: l10n.emptyHint,
|
||||
),
|
||||
),
|
||||
],
|
||||
child: EmptyState(
|
||||
key: const Key('favorites-empty'),
|
||||
icon: Icons.star_border_rounded,
|
||||
title: l10n.noFavorites,
|
||||
subtitle: l10n.emptyHint,
|
||||
stretchContent: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _refreshable(
|
||||
@@ -205,6 +196,20 @@ class _FavoritesBody extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _refreshableState(
|
||||
FavoriteController favorites, {
|
||||
required Widget child,
|
||||
}) {
|
||||
return AppPullToRefresh(
|
||||
onRefresh: favorites.load,
|
||||
child: CustomScrollView(
|
||||
key: const Key('favorites-empty-scroll'),
|
||||
physics: AppPullToRefresh.physics,
|
||||
slivers: [SliverFillRemaining(hasScrollBody: false, child: child)],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool _onScroll(ScrollNotification notification) {
|
||||
if (notification.depth != 0) return false;
|
||||
final reachedBottom =
|
||||
|
||||
@@ -53,7 +53,6 @@ class FilterResultCard extends StatelessWidget {
|
||||
RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackAspectRatio: 3 / 4,
|
||||
),
|
||||
if (drama.isHot)
|
||||
|
||||
@@ -64,7 +64,6 @@ class FollowingGridCard extends StatelessWidget {
|
||||
child: RemoteImage(
|
||||
posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -75,7 +75,6 @@ class FollowingHistoryCard extends StatelessWidget {
|
||||
child: RemoteImage(
|
||||
posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -40,7 +40,6 @@ class ContinueWatchingBanner extends StatelessWidget {
|
||||
RemoteImage(
|
||||
record.displayLandscapeCover,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
const DecoratedBox(
|
||||
|
||||
@@ -122,7 +122,6 @@ class HomeDramaCard extends StatelessWidget {
|
||||
drama.posterUrl,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.fitWidth,
|
||||
showFallbackIcon: true,
|
||||
fallbackAspectRatio: _coverAspectRatio,
|
||||
),
|
||||
Positioned(top: 8, left: 8, child: _tagBadge()),
|
||||
@@ -226,7 +225,9 @@ class HomeDramaCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _genre(BuildContext context) {
|
||||
final labels = drama.localizedTypeLabels(Localizations.localeOf(context).languageCode);
|
||||
final labels = drama.localizedTypeLabels(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
final genre = labels.isEmpty
|
||||
? (drama.genre.isEmpty ? drama.category : drama.genre)
|
||||
: labels.join(' / ');
|
||||
|
||||
@@ -12,11 +12,7 @@ import '../../../core/widgets/remote_image.dart';
|
||||
final RegExp _tagSplitter = RegExp(r'[,/、·]');
|
||||
|
||||
class HomeFeedCard extends StatelessWidget {
|
||||
const HomeFeedCard({
|
||||
super.key,
|
||||
required this.drama,
|
||||
required this.onTap,
|
||||
});
|
||||
const HomeFeedCard({super.key, required this.drama, required this.onTap});
|
||||
|
||||
final Drama drama;
|
||||
final VoidCallback onTap;
|
||||
@@ -44,7 +40,9 @@ class HomeFeedCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
drama.localizedTitle(Localizations.localeOf(context).languageCode),
|
||||
drama.localizedTitle(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
),
|
||||
key: Key('home-feed-title-${drama.id}'),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -69,7 +67,9 @@ class HomeFeedCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _cover(BuildContext context) {
|
||||
final label = drama.localizedTag(Localizations.localeOf(context).languageCode);
|
||||
final label = drama.localizedTag(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
return ClipRRect(
|
||||
key: Key('home-feed-cover-clip-${drama.id}'),
|
||||
borderRadius: BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||
@@ -82,7 +82,6 @@ class HomeFeedCard extends StatelessWidget {
|
||||
drama.posterUrl,
|
||||
key: Key('home-feed-cover-${drama.id}'),
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
if (label.isNotEmpty)
|
||||
@@ -133,7 +132,9 @@ class HomeFeedCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<String> _cardTags(BuildContext context) {
|
||||
final localized = drama.localizedTypeLabels(Localizations.localeOf(context).languageCode);
|
||||
final localized = drama.localizedTypeLabels(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
if (localized.isNotEmpty) return localized.take(3).toList(growable: false);
|
||||
final seen = <String>{};
|
||||
return [drama.genre, drama.category]
|
||||
|
||||
@@ -22,6 +22,7 @@ import '../../../l10n/app_localizations.dart';
|
||||
import 'home_category_dramas.dart';
|
||||
import 'home_feed_card.dart';
|
||||
import 'home_grid_header.dart';
|
||||
import 'home_ranking_dramas.dart';
|
||||
|
||||
const double _loadMoreThreshold = 240;
|
||||
|
||||
@@ -175,6 +176,12 @@ class _HomeFeedGridState extends State<HomeFeedGrid> {
|
||||
required CatalogController catalog,
|
||||
}) {
|
||||
final controller = context.read<CategoryController>();
|
||||
if (category.isRanking) {
|
||||
return HomeRankingDramas(
|
||||
categoryId: category.categoryId,
|
||||
onOpenDrama: widget.onOpenDrama,
|
||||
);
|
||||
}
|
||||
if (controller.dramaPageLoader != null && category.categoryId.isNotEmpty) {
|
||||
return HomeCategoryDramas(
|
||||
lockedCategoryId: category.categoryId,
|
||||
@@ -320,6 +327,7 @@ class _HomeFeedGridState extends State<HomeFeedGrid> {
|
||||
categoryName: category.name,
|
||||
categoryId: category.id,
|
||||
tab: HomePrimaryTab.categories,
|
||||
layoutType: category.layoutType,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -23,12 +23,16 @@ class HomeGridCategoryShortcut {
|
||||
required this.categoryName,
|
||||
required this.categoryId,
|
||||
required this.tab,
|
||||
this.layoutType = 'GRID',
|
||||
});
|
||||
|
||||
final String label;
|
||||
final String categoryName;
|
||||
final String categoryId;
|
||||
final HomePrimaryTab tab;
|
||||
final String layoutType;
|
||||
|
||||
bool get isRanking => layoutType == 'RANKING';
|
||||
}
|
||||
|
||||
class HomeGridCallbacks {
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../core/data/models/category_ranking.dart';
|
||||
import '../../../core/data/models/drama.dart';
|
||||
import '../../../core/data/services/category_controller.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_dimens.dart';
|
||||
import '../../../core/widgets/app_pull_to_refresh.dart';
|
||||
import '../../../core/widgets/drama_grid_skeleton.dart';
|
||||
import '../../../core/widgets/empty_state.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../ranking/widgets/ranking_drama_row.dart';
|
||||
|
||||
/// 榜单页顶部暗红光晕,向下淡入纯黑(与剧场榜单页一致)。
|
||||
const BoxDecoration _rankingBackdrop = BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
AppColors.followingGlow,
|
||||
AppColors.followingGlowMid,
|
||||
AppColors.appBackground,
|
||||
],
|
||||
stops: [0, 0.14, 0.3],
|
||||
),
|
||||
);
|
||||
|
||||
/// 推荐榜频道:服务端排名快照,统一行布局,名次角标压在封面左上角。
|
||||
class HomeRankingDramas extends StatefulWidget {
|
||||
const HomeRankingDramas({
|
||||
super.key,
|
||||
required this.categoryId,
|
||||
required this.onOpenDrama,
|
||||
this.topPadding = AppDimens.spaceLg,
|
||||
});
|
||||
|
||||
final String categoryId;
|
||||
final ValueChanged<Drama> onOpenDrama;
|
||||
final double topPadding;
|
||||
|
||||
@override
|
||||
State<HomeRankingDramas> createState() => _HomeRankingDramasState();
|
||||
}
|
||||
|
||||
class _HomeRankingDramasState extends State<HomeRankingDramas> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _ensureLoaded());
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(HomeRankingDramas oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.categoryId != widget.categoryId) _ensureLoaded();
|
||||
}
|
||||
|
||||
void _ensureLoaded() {
|
||||
if (!mounted) return;
|
||||
final controller = context.read<CategoryController>();
|
||||
final slot = controller.rankingSlotOf(widget.categoryId);
|
||||
if (slot.loading || slot.ranking != null) return;
|
||||
unawaited(controller.openRanking(widget.categoryId));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final controller = context.watch<CategoryController>();
|
||||
final slot = controller.rankingSlotOf(widget.categoryId);
|
||||
final entries = slot.ranking?.entries ?? const <CategoryRankingEntry>[];
|
||||
if (slot.loading && entries.isEmpty) {
|
||||
return const DecoratedBox(
|
||||
key: Key('home-ranking-surface'),
|
||||
decoration: _rankingBackdrop,
|
||||
child: DramaGridSkeleton(
|
||||
key: Key('home-ranking-skeleton'),
|
||||
columns: 3,
|
||||
horizontalPadding: AppDimens.feedPageHorizontal,
|
||||
crossAxisSpacing: AppDimens.homeGridGap,
|
||||
mainAxisSpacing: AppDimens.homeGridRowGap,
|
||||
),
|
||||
);
|
||||
}
|
||||
return DecoratedBox(
|
||||
key: const Key('home-ranking-surface'),
|
||||
decoration: _rankingBackdrop,
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: AppPullToRefresh(
|
||||
key: const Key('home-ranking-refresh'),
|
||||
onRefresh: () => controller.openRanking(widget.categoryId),
|
||||
child: _content(context, entries, slot.error),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _content(
|
||||
BuildContext context,
|
||||
List<CategoryRankingEntry> entries,
|
||||
Object? error,
|
||||
) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
if (entries.isEmpty) {
|
||||
return CustomScrollView(
|
||||
key: PageStorageKey<String>('home-ranking-scroll-${widget.categoryId}'),
|
||||
physics: AppPullToRefresh.physics,
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: EmptyState(
|
||||
key: Key(
|
||||
error == null ? 'home-ranking-empty' : 'home-ranking-error',
|
||||
),
|
||||
icon: error == null
|
||||
? Icons.leaderboard_outlined
|
||||
: Icons.cloud_off_rounded,
|
||||
title: error == null ? l10n.emptyContent : l10n.catalogError,
|
||||
actionLabel: error == null ? null : l10n.retry,
|
||||
onAction: error == null
|
||||
? null
|
||||
: () => unawaited(
|
||||
context.read<CategoryController>().openRanking(
|
||||
widget.categoryId,
|
||||
),
|
||||
),
|
||||
stretchContent: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return CustomScrollView(
|
||||
key: PageStorageKey<String>('home-ranking-scroll-${widget.categoryId}'),
|
||||
physics: AppPullToRefresh.physics,
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
AppDimens.feedPageHorizontal,
|
||||
widget.topPadding,
|
||||
AppDimens.feedPageHorizontal,
|
||||
AppDimens.spaceXl,
|
||||
),
|
||||
sliver: SliverList.separated(
|
||||
itemCount: entries.length,
|
||||
itemBuilder: (context, index) => _row(entries[index]),
|
||||
separatorBuilder: (_, _) => const Divider(
|
||||
height: AppDimens.mineGridDividerWidth,
|
||||
thickness: AppDimens.mineGridDividerWidth,
|
||||
color: AppColors.border,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _row(CategoryRankingEntry entry) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: AppDimens.spaceSm),
|
||||
child: RankingDramaRow(
|
||||
rank: entry.rank,
|
||||
drama: entry.drama,
|
||||
onTap: () => widget.onOpenDrama(entry.drama),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,6 @@ class MineContinueWatching extends StatelessWidget {
|
||||
child: RemoteImage(
|
||||
record.dramaCover ?? '',
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackColor: AppColors.contentSurface,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -276,7 +276,6 @@ class _NewReleasesPageState extends State<NewReleasesPage> {
|
||||
RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackAspectRatio: 16 / 9,
|
||||
),
|
||||
const DecoratedBox(
|
||||
@@ -448,7 +447,6 @@ class _NewReleasesPageState extends State<NewReleasesPage> {
|
||||
RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
fallbackAspectRatio: 3 / 4,
|
||||
),
|
||||
Positioned(
|
||||
|
||||
@@ -255,11 +255,7 @@ class _DramaInfoSheetState extends State<DramaInfoSheet> {
|
||||
width: _posterWidth,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 3 / 4,
|
||||
child: RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
),
|
||||
child: RemoteImage(drama.posterUrl, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -466,11 +462,7 @@ class _DramaInfoSheetState extends State<DramaInfoSheet> {
|
||||
width: _relatedWidth,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 3 / 4,
|
||||
child: RemoteImage(
|
||||
drama.posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
showFallbackIcon: true,
|
||||
),
|
||||
child: RemoteImage(drama.posterUrl, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -35,13 +35,8 @@ const _metadataStrutStyle = StrutStyle(
|
||||
const double _watchAllInset = 12;
|
||||
const double _watchAllRadius = 6;
|
||||
const double _watchAllFont = 16;
|
||||
const _watchAllGradient = LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [AppColors.mineStatShade, AppColors.brandRed, AppColors.vipButtonEnd],
|
||||
);
|
||||
|
||||
/// 「观看完整剧集」渐变按钮高度,overlay 用它安排底部避让。
|
||||
/// 「观看完整剧集」按钮高度,overlay 用它安排底部避让。
|
||||
const double homeFeedWatchAllHeight = _watchAllHeight;
|
||||
|
||||
/// 播放量紧凑展示(跟随语言):zh 20万 / en 200K / id 200 rb。
|
||||
@@ -212,8 +207,13 @@ class HomeFeedWatchAllBar extends StatelessWidget {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(_watchAllRadius),
|
||||
child: DecoratedBox(
|
||||
key: const Key('home-feed-full-series-gradient'),
|
||||
decoration: const BoxDecoration(gradient: _watchAllGradient),
|
||||
key: const Key('home-feed-full-series-surface'),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.watchAllSurface,
|
||||
border: Border.fromBorderSide(
|
||||
BorderSide(color: AppColors.watchAllBorder),
|
||||
),
|
||||
),
|
||||
child: Material(
|
||||
key: const Key('home-feed-full-series-bg'),
|
||||
color: AppColors.transparent,
|
||||
|
||||
@@ -12,9 +12,9 @@ const double _defaultIconSize = 32;
|
||||
const double _defaultCountFont = 12;
|
||||
const double _defaultIconCountGap = 2;
|
||||
const double _defaultItemGap = 24;
|
||||
const _tapDuration = Duration(milliseconds: 360);
|
||||
const double _popScale = 1.34;
|
||||
const double _cancelScale = 0.68;
|
||||
const _tapDuration = Duration(milliseconds: 220);
|
||||
const double _popScale = 1.14;
|
||||
const double _cancelScale = 0.86;
|
||||
const double _popWeight = 40;
|
||||
const double _settleWeight = 60;
|
||||
final _growTween = _tapTween(_popScale);
|
||||
|
||||
@@ -3,8 +3,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_dimens.dart';
|
||||
|
||||
const _fadeDuration = Duration(milliseconds: 140);
|
||||
const _motionDuration = Duration(milliseconds: 1350);
|
||||
const _surfaceSize = Size(56, 36);
|
||||
const _logoSize = Size(48, 29);
|
||||
const _minimumScale = 0.98;
|
||||
const _staticProgress = 0.5;
|
||||
const _waveMultiplier = 2.0;
|
||||
const _sweepStart = -1.2;
|
||||
const _sweepTravel = 3.4;
|
||||
const _sweepFeather = 0.16;
|
||||
|
||||
/// 剧集播放页首帧出现前的非阻塞 YMB 品牌加载层。
|
||||
class PlayerLoadingOverlay extends StatelessWidget {
|
||||
const PlayerLoadingOverlay({
|
||||
super.key,
|
||||
@@ -19,27 +30,124 @@ class PlayerLoadingOverlay extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedOpacity(
|
||||
opacity: opacity,
|
||||
duration: const Duration(milliseconds: 140),
|
||||
duration: _fadeDuration,
|
||||
curve: Curves.easeOut,
|
||||
onEnd: onFadeEnd,
|
||||
child: Container(
|
||||
key: const Key('player-loading-surface'),
|
||||
width: AppDimens.refreshIndicatorSize,
|
||||
height: AppDimens.refreshIndicatorSize,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.refreshIndicatorSurface,
|
||||
borderRadius: BorderRadius.circular(AppDimens.refreshIndicatorRadius),
|
||||
),
|
||||
width: _surfaceSize.width,
|
||||
height: _surfaceSize.height,
|
||||
alignment: Alignment.center,
|
||||
child: const SizedBox.square(
|
||||
dimension: AppDimens.refreshSpinnerSize,
|
||||
child: CircularProgressIndicator(
|
||||
key: Key('player-entry-loading'),
|
||||
color: Colors.white,
|
||||
strokeWidth: AppDimens.refreshSpinnerStroke,
|
||||
),
|
||||
),
|
||||
child: const _YmbLoadingMark(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _YmbLoadingMark extends StatefulWidget {
|
||||
const _YmbLoadingMark();
|
||||
|
||||
@override
|
||||
State<_YmbLoadingMark> createState() => _YmbLoadingMarkState();
|
||||
}
|
||||
|
||||
class _YmbLoadingMarkState extends State<_YmbLoadingMark>
|
||||
with SingleTickerProviderStateMixin, WidgetsBindingObserver {
|
||||
late final AnimationController _controller;
|
||||
bool _disableAnimations = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_controller = AnimationController(vsync: this, duration: _motionDuration);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final disableAnimations = MediaQuery.disableAnimationsOf(context);
|
||||
if (_disableAnimations == disableAnimations && _controller.isAnimating) {
|
||||
return;
|
||||
}
|
||||
_disableAnimations = disableAnimations;
|
||||
_syncMotion(WidgetsBinding.instance.lifecycleState);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
_syncMotion(state);
|
||||
}
|
||||
|
||||
void _syncMotion(AppLifecycleState? state) {
|
||||
if (_disableAnimations) {
|
||||
_controller
|
||||
..stop()
|
||||
..value = _staticProgress;
|
||||
return;
|
||||
}
|
||||
if (state == null || state == AppLifecycleState.resumed) {
|
||||
if (!_controller.isAnimating) {
|
||||
_controller.repeat();
|
||||
}
|
||||
return;
|
||||
}
|
||||
_controller.stop();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
final progress = _controller.value;
|
||||
return _buildLogo(progress);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogo(double progress) {
|
||||
final pulse = Curves.easeInOut.transform(_triangleWave(progress));
|
||||
final scale = _minimumScale + (1 - _minimumScale) * pulse;
|
||||
return Transform.scale(
|
||||
key: const Key('player-entry-loading-motion'),
|
||||
scale: scale,
|
||||
child: ShaderMask(
|
||||
blendMode: BlendMode.srcATop,
|
||||
shaderCallback: (bounds) =>
|
||||
_logoGradient(progress).createShader(bounds),
|
||||
child: Image.asset(
|
||||
'assets/icon/splash_logo.png',
|
||||
key: const Key('player-entry-loading'),
|
||||
width: _logoSize.width,
|
||||
height: _logoSize.height,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
LinearGradient _logoGradient(double progress) {
|
||||
final center = _sweepStart + progress * _sweepTravel;
|
||||
return LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: const [
|
||||
Colors.white,
|
||||
Colors.white,
|
||||
AppColors.brandRed,
|
||||
Colors.white,
|
||||
],
|
||||
stops: [0, (center - _sweepFeather).clamp(0, 1), center.clamp(0, 1), 1],
|
||||
);
|
||||
}
|
||||
|
||||
double _triangleWave(double value) => 1 - (value * _waveMultiplier - 1).abs();
|
||||
}
|
||||