fix(home): 调整首页分类与卡片标签样式
This commit is contained in:
1 parent
7446431511
commit
4f6116896f
14 files changed
+251
-117
No files matched your search
@@ -41,6 +41,13 @@ void main() {
|
||||
final cover = find.byKey(const Key('home-feed-cover-anime-card'));
|
||||
final coverSize = tester.getSize(cover);
|
||||
expect(coverSize.height / coverSize.width, closeTo(6 / 5, 0.02));
|
||||
final coverClip = tester.widget<ClipRRect>(
|
||||
find.byKey(const Key('home-feed-cover-clip-anime-card')),
|
||||
);
|
||||
expect(
|
||||
coverClip.borderRadius,
|
||||
BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||
);
|
||||
final badge = find.byKey(const Key('home-feed-badge-anime-anime-card'));
|
||||
expect(badge, findsOneWidget);
|
||||
final badgeContainer = tester.widget<Container>(badge);
|
||||
@@ -61,9 +68,16 @@ void main() {
|
||||
final viewsText = tester.widget<Text>(
|
||||
find.descendant(of: views, matching: find.byType(Text)),
|
||||
);
|
||||
expect(viewsText.data, startsWith('44.'));
|
||||
expect(viewsText.data, '44.5w');
|
||||
expect(viewsText.style?.fontSize, AppDimens.cardViewsFont);
|
||||
expect(viewsText.style?.color, AppColors.navSelected);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: views,
|
||||
matching: find.byIcon(Icons.auto_awesome_rounded),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final title = tester.widget<Text>(
|
||||
find.byKey(const Key('home-feed-title-anime-card')),
|
||||
);
|
||||
@@ -71,14 +85,15 @@ void main() {
|
||||
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
||||
expect(title.style?.fontWeight, FontWeight.w500);
|
||||
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
||||
final tags = tester.widget<Text>(
|
||||
find.byKey(const Key('home-feed-tags-anime-card')),
|
||||
final ribbon = find.byKey(const Key('drama-genre-ribbon-anime-card-0'));
|
||||
expect(ribbon, findsOneWidget);
|
||||
final ribbonText = tester.widget<Text>(
|
||||
find.descendant(of: ribbon, matching: find.byType(Text)),
|
||||
);
|
||||
expect(tags.data, 'Romance | Urban');
|
||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||
expect(tags.style?.color, AppColors.textTertiary);
|
||||
expect(ribbonText.data, 'Romance');
|
||||
expect(ribbonText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||
expect(ribbonText.style?.color, AppColors.textPrimary);
|
||||
expect(tester.getTopLeft(title).dx, tester.getTopLeft(cover).dx);
|
||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
||||
|
||||
await tester.tap(card);
|
||||
expect(taps, 1);
|
||||
|
||||
@@ -108,6 +108,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('home-section-new')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('new-releases-page')), findsNothing);
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsNothing);
|
||||
expect(firstDramaId(), 'page1-9');
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-section-ranking')));
|
||||
@@ -118,6 +119,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('home-section-categories')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('filter-page')), findsNothing);
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsNothing);
|
||||
expect(find.byKey(const Key('home-grid-cards')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-section-category-古装')));
|
||||
@@ -154,6 +156,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('home-section-featured')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsOneWidget);
|
||||
|
||||
final afterScrollable = find
|
||||
.descendant(
|
||||
|
||||
Reference in new issue
Block a user