feat(reward): 新增客户端奖励中心

This commit is contained in:
Zhou Weidong committed 2026-11-13 13:43:38 +08:00
1 parent 67670d46b1
commit bea08110c9
68 files changed
+3987 -332

No files matched your search

@@ -15,6 +15,60 @@ import '../support/fake_catalog.dart';
import '../support/fake_category.dart';
void main() {
testWidgets('should_keep_refresh_indicator_below_category_nav_when_pulling', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final controller = CategoryController(
FakeCategoryRepository(catalog: FakeCatalogRepository()),
);
final dramas = [for (var index = 1; index <= 12; index++) _drama('$index')];
controller.categories = const [ContentCategory(id: '7', name: 'Romance')];
controller.dramaPageLoader =
(categoryId, {pageIndex = 1, pageSize = 20}) async =>
PageResult(total: dramas.length, list: dramas);
addTearDown(controller.dispose);
await tester.pumpWidget(
MaterialApp(
locale: const Locale('en'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(
body: ChangeNotifierProvider<CategoryController>.value(
value: controller,
child: const RecommendDiscoverPage(active: true, onSearch: _noop),
),
),
),
);
await tester.pumpAndSettle();
final nav = tester.getRect(find.byKey(const Key('recommend-tab-7')));
final scroll = find.byKey(const PageStorageKey<String>('recommend-feed-7'));
final scrollable = tester.state<ScrollableState>(
find.descendant(of: scroll, matching: find.byType(Scrollable)).first,
);
expect(scrollable.position.pixels, 0);
final scrollRect = tester.getRect(scroll);
final gesture = await tester.startGesture(
Offset(scrollRect.center.dx, scrollRect.top + 120),
);
await gesture.moveBy(const Offset(0, 160));
await tester.pump();
final indicator = find.byKey(const Key('pull-refresh-indicator'));
expect(indicator, findsOneWidget);
expect(tester.getRect(indicator).top, greaterThanOrEqualTo(nav.bottom));
await gesture.up();
await tester.pumpAndSettle();
});
testWidgets('should_center_empty_state_when_category_has_no_dramas', (
tester,
) async {