style(client): 对齐短剧列表字号与间距

This commit is contained in:
Zhou Weidong committed 2026-10-22 18:06:03 +08:00
1 parent d03dcf162e
commit d7a59e5a27
17 files changed
+576 -148

No files matched your search

+73
View File
@@ -8,6 +8,8 @@ import 'package:fruitshorts/core/data/models/watch_progress.dart';
import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/core/theme/app_dimens.dart';
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
@@ -41,6 +43,50 @@ void main() {
expect(find.byKey(const Key('following-tab-reserve')), findsOneWidget);
expect(find.byKey(const Key('following-favorites-grid')), findsOneWidget);
expect(find.byType(CustomScrollView), findsWidgets);
final tab = tester.widget<Text>(
find.descendant(
of: find.byKey(const Key('following-tab-favorites')),
matching: find.text('Following'),
),
);
expect(tab.style?.fontSize, AppDimens.followingTabFont);
expect(tab.style?.fontWeight, FontWeight.w700);
expect(tab.style?.color, AppColors.textPrimary);
final grid = tester.widget<SliverGrid>(
find.descendant(
of: find.byKey(const Key('following-favorites-grid')),
matching: find.byType(SliverGrid),
),
);
final delegate =
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
expect(delegate.crossAxisSpacing, AppDimens.homeGridGap);
expect(delegate.mainAxisSpacing, AppDimens.homeGridRowGap);
expect(delegate.childAspectRatio, AppDimens.followingGridAspectRatio);
final card = find.byKey(const Key('following-card-the-signal-demo'));
final cover = tester.widget<AspectRatio>(
find.byKey(const Key('following-cover-the-signal-demo')),
);
expect(cover.aspectRatio, AppDimens.cardCoverAspectRatio);
final title = tester.widget<Text>(
find.descendant(of: card, matching: find.text('The Signal')),
);
expect(title.style?.fontSize, AppDimens.cardTitleFont);
expect(title.style?.fontWeight, FontWeight.w500);
expect(title.style?.height, AppDimens.cardTitleLineHeight);
final views = tester.widget<Text>(
find.byKey(const Key('following-views-the-signal-demo')),
);
expect(views.style?.fontSize, AppDimens.cardViewsFont);
expect(views.style?.color, AppColors.textPrimary);
final tag = find.byKey(const Key('following-tag-the-signal-demo-0'));
expect(tag, findsOneWidget);
expect(tester.getSize(tag).height, AppDimens.cardTagHeight);
final tagText = tester.widget<Text>(
find.descendant(of: tag, matching: find.byType(Text)),
);
expect(tagText.style?.fontSize, AppDimens.cardTagFont);
expect(tagText.style?.color, AppColors.textTertiary);
await tester.tap(find.byKey(const Key('following-edit')));
await tester.pumpAndSettle();
@@ -171,6 +217,33 @@ void main() {
);
expect(find.byIcon(Icons.edit_outlined), findsOneWidget);
});
testWidgets('should_fit_following_cards_on_compact_viewport', (tester) async {
tester.view.physicalSize = const Size(320, 640);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
_signIn();
final catalog = FakeCatalogRepository();
await tester.pumpWidget(
_app(
catalog: catalog,
favorites: InMemoryFavoriteRepository(
cards: catalog.dramas.take(1).toList(),
saved: {catalog.dramas.first.id},
),
),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('tab-follow')));
await tester.pumpAndSettle();
expect(
find.byKey(const Key('following-card-the-signal-demo')),
findsOneWidget,
);
expect(tester.takeException(), isNull);
});
}
void _signIn() {