feat(recommend): 支持横向切换三个内容页

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:34:58 +08:00
1 parent 5fce65ac57
commit 17faa749b2
3 files changed
+121 -17

No files matched your search

+42 -2
View File
@@ -91,7 +91,7 @@ void main() {
expect(player.homeMode, isTrue);
expect(player.embedded, isTrue);
expect(player.showHomeFeedHeader, isFalse);
expect(find.byType(PageView), findsOneWidget);
expect(find.byType(PageView), findsNWidgets(2));
expect(find.byKey(const Key('recommend-section-hits')), findsNothing);
expect(find.byType(AppBottomNav), findsOneWidget);
@@ -269,7 +269,7 @@ void main() {
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('recommend-section-hits')), findsOneWidget);
expect(find.byKey(const Key('recommend-feed-player')), findsNothing);
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
expect(find.byType(AppBottomNav), findsOneWidget);
await tester.tap(find.byKey(const Key('recommend-tab-all')));
@@ -278,6 +278,46 @@ void main() {
expect(find.byKey(const Key('all-dramas-grid')), findsOneWidget);
});
testWidgets('should_switch_inner_tabs_with_horizontal_page_swipes', (
tester,
) async {
await _pumpRecommend(tester);
final pages = find.byKey(const Key('recommend-tab-page-view'));
final topNavBefore = tester.getRect(
find.byKey(const Key('recommend-top-nav')),
);
await tester.drag(pages, const Offset(-320, 0));
await tester.pumpAndSettle();
expect(find.byKey(const Key('recommend-section-hits')), findsOneWidget);
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
expect(
tester
.widget<Text>(
find.descendant(
of: find.byKey(const Key('recommend-tab-playlist')),
matching: find.text('Playlists'),
),
)
.style
?.color,
AppColors.textPrimary,
);
expect(
tester.getRect(find.byKey(const Key('recommend-top-nav'))),
topNavBefore,
);
await tester.drag(pages, const Offset(-320, 0));
await tester.pumpAndSettle();
expect(find.byKey(const Key('all-dramas-grid')), findsOneWidget);
await tester.drag(pages, const Offset(640, 0));
await tester.pumpAndSettle();
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
expect(find.byKey(const Key('recommend-tab-recommend')), findsOneWidget);
});
testWidgets('should_open_standalone_player_from_title_and_watch_all', (
tester,
) async {