feat(recommend): 新增分区流全部短剧与剧单

This commit is contained in:
Zhou Weidong committed 2026-10-22 17:23:22 +08:00
1 parent 0ef2438100
commit f1b5418954
22 files changed
+1426 -722

No files matched your search

@@ -79,7 +79,6 @@ void main() {
catalogRepository: catalog,
categoryRepository: _GridCategoryRepository(),
);
await tester.tap(find.byKey(const Key('theater-category-7')));
await tester.pumpAndSettle();
@@ -187,38 +186,6 @@ void main() {
);
});
testWidgets('should_load_next_theater_page_near_scroll_bottom', (
tester,
) async {
final catalog = _PagedTheaterCatalog([
FeedPage(dramas: _pageDramas(0, 20), nextCursor: '20', hasMore: true),
FeedPage(dramas: _pageDramas(20, 20)),
]);
await _pumpTheater(
tester,
catalogRepository: catalog,
categoryRepository: _GridCategoryRepository(),
);
final position = tester
.state<ScrollableState>(
find
.descendant(
of: find.byKey(const Key('discover-refresh')),
matching: find.byType(Scrollable),
)
.first,
)
.position;
position.jumpTo(position.maxScrollExtent);
await tester.pump();
await tester.pumpAndSettle();
expect(catalog.calls, 2);
expect(catalog.requestedCursors, [null, '20']);
expect(find.byKey(const Key('home-drama-card-page-39')), findsOneWidget);
});
testWidgets('should_refresh_feed_when_pulled_down', (tester) async {
final counter = _CountingCategoryRepository(
_GridCategoryRepository(discoverFeed: _tallDiscoverFeed),
@@ -656,34 +623,6 @@ class _CountingTheaterCatalog extends _TheaterOnlyCatalog {
}
}
class _PagedTheaterCatalog extends _TheaterOnlyCatalog {
_PagedTheaterCatalog(this.pages);
final List<FeedPage> pages;
final List<String?> requestedCursors = [];
int get calls => requestedCursors.length;
@override
Future<FeedPage> fetchFeed({
List<String> types = const [],
String? categoryId,
String? cursor,
int size = 10,
}) async {
if (size != 20) {
return super.fetchFeed(
types: types,
categoryId: categoryId,
cursor: cursor,
size: size,
);
}
requestedCursors.add(cursor);
return pages.removeAt(0);
}
}
class _FailingTheaterCatalog extends _TheaterOnlyCatalog {
@override
Future<FeedPage> fetchFeed({
@@ -703,14 +642,3 @@ class _FailingTheaterCatalog extends _TheaterOnlyCatalog {
);
}
}
List<Drama> _pageDramas(int start, int count) => [
for (var index = start; index < start + count; index++)
Drama(
id: 'page-$index',
title: 'Page $index',
synopsis: 'Page $index synopsis',
posterUrl: '',
genre: 'Drama',
),
];