fix(home): 修正首页分类与卡片布局
This commit is contained in:
1 parent
10477562d4
commit
aa4870cce6
14 files changed
+573
-459
No files matched your search
@@ -109,23 +109,29 @@ void main() {
|
||||
);
|
||||
expect(placeholder.style?.fontSize, AppDimens.searchPlaceholderFont);
|
||||
expect(placeholder.style?.color, AppColors.textSecondary);
|
||||
final selectedPrimary = tester.widget<Text>(
|
||||
final selectedPrimary = tester.widget<AnimatedDefaultTextStyle>(
|
||||
find.byKey(const Key('home-primary-label-featured')),
|
||||
);
|
||||
final unselectedPrimary = tester.widget<AnimatedDefaultTextStyle>(
|
||||
find.byKey(const Key('home-primary-label-newReleases')),
|
||||
);
|
||||
expect(
|
||||
selectedPrimary.style.fontSize,
|
||||
AppDimens.homePrimaryTabSelectedFont,
|
||||
);
|
||||
expect(selectedPrimary.style.fontWeight, FontWeight.w700);
|
||||
expect(selectedPrimary.style.color, AppColors.navSelected);
|
||||
expect(selectedPrimary.duration, AppDimens.homePrimaryTabAnimationDuration);
|
||||
expect(unselectedPrimary.style.fontSize, AppDimens.homePrimaryTabFont);
|
||||
expect(unselectedPrimary.style.fontWeight, FontWeight.w400);
|
||||
expect(unselectedPrimary.style.color, AppColors.textTertiary);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-section-featured')),
|
||||
matching: find.text('Featured'),
|
||||
matching: find.byType(Container),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
final unselectedPrimary = tester.widget<Text>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-section-new')),
|
||||
matching: find.text('New'),
|
||||
),
|
||||
);
|
||||
expect(selectedPrimary.style?.fontSize, AppDimens.homePrimaryTabFont);
|
||||
expect(selectedPrimary.style?.fontWeight, FontWeight.w700);
|
||||
expect(selectedPrimary.style?.color, AppColors.navSelected);
|
||||
expect(unselectedPrimary.style?.fontWeight, FontWeight.w400);
|
||||
expect(unselectedPrimary.style?.color, AppColors.textTertiary);
|
||||
final secondaryTag = tester.widget<Text>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-tag-hot')),
|
||||
@@ -135,18 +141,38 @@ void main() {
|
||||
expect(secondaryTag.style?.fontSize, AppDimens.homeSecondaryTagFont);
|
||||
expect(secondaryTag.style?.fontWeight, FontWeight.w400);
|
||||
expect(secondaryTag.style?.color, AppColors.textTertiary);
|
||||
final unselectedTagChip = tester.widget<Container>(
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-tag-hot')),
|
||||
matching: find.byType(Container),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
final primaryStart = tester.getTopLeft(find.text('Featured'));
|
||||
final pageStart = tester.getTopLeft(searchBox);
|
||||
expect(primaryStart.dx, pageStart.dx);
|
||||
final primaryGap =
|
||||
tester.getTopLeft(find.text('New')).dx -
|
||||
tester.getBottomRight(find.text('Featured')).dx;
|
||||
expect(primaryGap, closeTo(AppDimens.homePrimaryCategoryGap, 0.1));
|
||||
final tagStart = tester.getTopLeft(find.text('Hot'));
|
||||
expect(tagStart.dx, pageStart.dx);
|
||||
final tagGap =
|
||||
tester.getTopLeft(find.text('Uplifting')).dx -
|
||||
tester.getBottomRight(find.text('Hot')).dx;
|
||||
expect(tagGap, closeTo(AppDimens.homeSecondaryTagGap, 0.1));
|
||||
await tester.tap(find.byKey(const Key('home-tag-hot')));
|
||||
await tester.pump();
|
||||
final selectedTagChip = tester.widget<Container>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-tag-hot')),
|
||||
matching: find.byType(Container),
|
||||
),
|
||||
);
|
||||
expect(
|
||||
(unselectedTagChip.decoration! as BoxDecoration).color,
|
||||
AppColors.transparent,
|
||||
(selectedTagChip.decoration! as BoxDecoration).color,
|
||||
AppColors.contentSurface,
|
||||
);
|
||||
await tester.tap(find.byKey(const Key('home-tag-hot')));
|
||||
await tester.pump();
|
||||
final selectedTag = tester.widget<Text>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-tag-hot')),
|
||||
|
||||
Reference in new issue
Block a user