feat(home): 顶部导航随翻页联动并把推荐更名为精选

This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-30 22:53:15 +08:00
1 parent 2f4593a46e
commit 335e5dc286
27 files changed
+1095 -214

No files matched your search

+24 -13
View File
@@ -198,6 +198,11 @@ void main() {
posterUrl: '',
genre: 'Romance',
category: 'Urban',
types: [
{'en': 'Romance'},
{'en': 'Urban'},
{'en': 'Revenge'},
],
totalEpisodes: 8,
freeEpisodes: 8,
viewCount: 419000,
@@ -255,7 +260,7 @@ void main() {
);
expect(seriesTitle.data, 'Feed Drama');
expect(find.text('Episode 2'), findsNothing);
expect(seriesTitle.style?.fontSize, 17);
expect(seriesTitle.style?.fontSize, 18);
expect(seriesTitle.style?.fontWeight, FontWeight.w400);
expect(seriesTitle.style?.color, AppColors.textPrimary);
final seriesChevron = tester.widget<Icon>(
@@ -284,11 +289,13 @@ void main() {
expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget);
expect(find.byKey(const Key('home-feed-tags')), findsOneWidget);
expect(find.byKey(const Key('home-feed-tag-Romance')), findsOneWidget);
expect(find.byKey(const Key('home-feed-hot-badge')), findsNothing);
expect(find.byKey(const Key('home-feed-tag-Urban')), findsOneWidget);
expect(find.byKey(const Key('home-feed-tag-Revenge')), findsNothing);
final collapsedSynopsis = tester.widget<Text>(
find.byKey(const Key('home-feed-synopsis')),
);
expect(collapsedSynopsis.maxLines, 1);
expect(collapsedSynopsis.maxLines, 2);
expect(collapsedSynopsis.overflow, TextOverflow.ellipsis);
expect(find.byKey(const Key('home-feed-synopsis-more')), findsOneWidget);
await tester.tap(find.byKey(const Key('home-feed-synopsis-more')));
@@ -302,8 +309,9 @@ void main() {
.widget<Text>(find.byKey(const Key('home-feed-synopsis-expanded')))
.textSpan!
.toPlainText(),
allOf(contains('EP2'), contains('dangerous city')),
contains('dangerous city'),
);
expect(find.text('Episode 2 / 8'), findsOneWidget);
expect(
tester.widget<Text>(find.byKey(const Key('rail-like-count'))).data,
'1006',
@@ -358,10 +366,10 @@ void main() {
final likeRect = tester.getRect(find.byKey(const Key('rail-like')));
final commentsRect = tester.getRect(find.byKey(const Key('rail-comments')));
final shareRect = tester.getRect(find.byKey(const Key('rail-share')));
// 新版互动栏顺序:收藏 → 评论 → 喜欢 → 分享,间距 12。
expect(commentsRect.top - saveRect.bottom, closeTo(12, 0.1));
expect(likeRect.top - commentsRect.bottom, closeTo(12, 0.1));
expect(shareRect.top - likeRect.bottom, closeTo(12, 0.1));
// 互动栏顺序:收藏 → 评论 → 喜欢 → 分享,紧凑间距 6。
expect(commentsRect.top - saveRect.bottom, closeTo(6, 0.1));
expect(likeRect.top - commentsRect.bottom, closeTo(6, 0.1));
expect(shareRect.top - likeRect.bottom, closeTo(6, 0.1));
expect(
tester.getRect(find.byKey(const Key('home-feed-action-rail'))).right,
closeTo(
@@ -582,9 +590,13 @@ void main() {
final overlayRect = tester.getRect(
find.byKey(const Key('home-feed-gesture')),
);
// 观看条与底部进度条共用同一组左右边距(各 20pt),宽度一致。
// 观看条与左侧信息等宽,进度条仍横跨整个页面,避开右侧互动栏。
expect(bar.left, closeTo(overlayRect.left + 20, 0.1));
expect(bar.width, closeTo(overlayRect.width - 40, 0.1));
final infoRect = tester.getRect(
find.byKey(const Key('home-feed-info-panel')),
);
expect(bar.width, closeTo(infoRect.width, 0.1));
expect(bar.right, closeTo(infoRect.right, 0.1));
expect(
bar.left,
closeTo(
@@ -594,9 +606,8 @@ void main() {
);
expect(
bar.width,
closeTo(
lessThan(
tester.getRect(find.byKey(const Key('home-feed-progress'))).width,
0.1,
),
);
// 进度线贴着浮层底部(线心距底 4pt),且位于观看条下方。
@@ -609,10 +620,10 @@ void main() {
tester
.widget<Material>(find.byKey(const Key('home-feed-full-series-bg')))
.color,
AppColors.textPrimary.withValues(alpha: 0.15),
Colors.transparent,
);
expect(
tester.getRect(find.textContaining('Watch full series')).center.dy,
tester.getRect(find.text('Watch all')).center.dy,
closeTo(bar.center.dy, 2),
);
expect(