fix(home): 修复样式常量与测试类型错误
This commit is contained in:
1 parent
b3ea85df41
commit
ba0ce2f8c0
5 files changed
+30
-24
No files matched your search
@@ -1116,4 +1116,5 @@ $ flutter test
|
|||||||
- 标题下方恢复左对齐题材文字,使用 `|` 分隔、灰色小字,与封面状态角标保持独立。
|
- 标题下方恢复左对齐题材文字,使用 `|` 分隔、灰色小字,与封面状态角标保持独立。
|
||||||
- 首页搜索栏到一级、一级到二级、二级到网格间距为 8/8/10;非精选 tab 直接以 10 衔接网格。
|
- 首页搜索栏到一级、一级到二级、二级到网格间距为 8/8/10;非精选 tab 直接以 10 衔接网格。
|
||||||
- 播放量贴封面右下角(底 2、右 6),火焰图标 11 + 12/w400 纯文字,间距 4,并保留极淡底部渐变。
|
- 播放量贴封面右下角(底 2、右 6),火焰图标 11 + 12/w400 纯文字,间距 4,并保留极淡底部渐变。
|
||||||
|
- 修复二级 chip 运行时颜色误用 `const TextStyle` 的编译错误,并校正相关测试 Finder 类型。
|
||||||
- 全部短剧的地区、字幕、配音筛选 UI 已占位;以下接口待补:地区、字幕/配音筛选数据。
|
- 全部短剧的地区、字幕、配音筛选 UI 已占位;以下接口待补:地区、字幕/配音筛选数据。
|
||||||
@@ -366,7 +366,7 @@ class HomeGridHeader extends StatelessWidget {
|
|||||||
final selected = selectedTag == tag.id;
|
final selected = selectedTag == tag.id;
|
||||||
final label = Text(
|
final label = Text(
|
||||||
tag.label,
|
tag.label,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: selected ? AppColors.navSelected : AppColors.textTertiary,
|
color: selected ? AppColors.navSelected : AppColors.textTertiary,
|
||||||
fontSize: AppDimens.homeSecondaryTagFont,
|
fontSize: AppDimens.homeSecondaryTagFont,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|||||||
@@ -79,9 +79,11 @@ void main() {
|
|||||||
coverClip.borderRadius,
|
coverClip.borderRadius,
|
||||||
BorderRadius.circular(AppDimens.cardCoverRadius),
|
BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||||
);
|
);
|
||||||
final title = tester.widget<Text>(
|
final titleFinder = find.descendant(
|
||||||
find.descendant(of: card, matching: find.text('The Signal')),
|
of: card,
|
||||||
|
matching: find.text('The Signal'),
|
||||||
);
|
);
|
||||||
|
final title = tester.widget<Text>(titleFinder);
|
||||||
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
||||||
expect(title.style?.fontWeight, FontWeight.w500);
|
expect(title.style?.fontWeight, FontWeight.w500);
|
||||||
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
||||||
@@ -105,14 +107,15 @@ void main() {
|
|||||||
),
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
final tags = tester.widget<Text>(
|
final tagsFinder = find.byKey(
|
||||||
find.byKey(const Key('following-tags-the-signal-demo')),
|
const Key('following-tags-the-signal-demo'),
|
||||||
);
|
);
|
||||||
|
final tags = tester.widget<Text>(tagsFinder);
|
||||||
expect(tags.data, 'Suspense | Mystery');
|
expect(tags.data, 'Suspense | Mystery');
|
||||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||||
expect(tags.style?.color, AppColors.textTertiary);
|
expect(tags.style?.color, AppColors.textTertiary);
|
||||||
expect(tester.getTopLeft(title).dx, tester.getTopLeft(coverFinder).dx);
|
expect(tester.getTopLeft(titleFinder).dx, tester.getTopLeft(coverFinder).dx);
|
||||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
expect(tester.getTopLeft(tagsFinder).dx, tester.getTopLeft(coverFinder).dx);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('following-edit')));
|
await tester.tap(find.byKey(const Key('following-edit')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|||||||
@@ -80,10 +80,7 @@ void main() {
|
|||||||
expect(viewsText.style?.fontSize, AppDimens.cardPlayCountFont);
|
expect(viewsText.style?.fontSize, AppDimens.cardPlayCountFont);
|
||||||
expect(viewsText.style?.fontWeight, FontWeight.w400);
|
expect(viewsText.style?.fontWeight, FontWeight.w400);
|
||||||
expect(viewsText.style?.color, AppColors.navSelected);
|
expect(viewsText.style?.color, AppColors.navSelected);
|
||||||
expect(
|
expect(find.descendant(of: cover, matching: views), findsOneWidget);
|
||||||
find.descendant(of: cover, matching: find.byKey(views)),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(cover).dx - tester.getTopRight(views).dx,
|
tester.getTopRight(cover).dx - tester.getTopRight(views).dx,
|
||||||
AppDimens.cardPlayCountRight,
|
AppDimens.cardPlayCountRight,
|
||||||
@@ -103,21 +100,21 @@ void main() {
|
|||||||
),
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
final title = tester.widget<Text>(
|
final titleFinder = find.byKey(
|
||||||
find.byKey(const Key('home-feed-title-anime-card')),
|
const Key('home-feed-title-anime-card'),
|
||||||
);
|
);
|
||||||
|
final title = tester.widget<Text>(titleFinder);
|
||||||
expect(title.maxLines, 2);
|
expect(title.maxLines, 2);
|
||||||
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
||||||
expect(title.style?.fontWeight, FontWeight.w500);
|
expect(title.style?.fontWeight, FontWeight.w500);
|
||||||
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
||||||
final tags = tester.widget<Text>(
|
final tagsFinder = find.byKey(const Key('home-feed-tags-anime-card'));
|
||||||
find.byKey(const Key('home-feed-tags-anime-card')),
|
final tags = tester.widget<Text>(tagsFinder);
|
||||||
);
|
|
||||||
expect(tags.data, 'Romance | Urban');
|
expect(tags.data, 'Romance | Urban');
|
||||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||||
expect(tags.style?.color, AppColors.textTertiary);
|
expect(tags.style?.color, AppColors.textTertiary);
|
||||||
expect(tester.getTopLeft(title).dx, tester.getTopLeft(cover).dx);
|
expect(tester.getTopLeft(titleFinder).dx, tester.getTopLeft(cover).dx);
|
||||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
expect(tester.getTopLeft(tagsFinder).dx, tester.getTopLeft(cover).dx);
|
||||||
|
|
||||||
await tester.tap(card);
|
await tester.tap(card);
|
||||||
expect(taps, 1);
|
expect(taps, 1);
|
||||||
|
|||||||
@@ -98,9 +98,10 @@ void main() {
|
|||||||
);
|
);
|
||||||
final cover = tester.widget<AspectRatio>(coverFinder);
|
final cover = tester.widget<AspectRatio>(coverFinder);
|
||||||
expect(cover.aspectRatio, AppDimens.cardCoverAspectRatio);
|
expect(cover.aspectRatio, AppDimens.cardCoverAspectRatio);
|
||||||
final cardTitle = tester.widget<Text>(
|
final cardTitleFinder = find.byKey(
|
||||||
find.byKey(const Key('recommend-title-hits-the-signal-demo')),
|
const Key('recommend-title-hits-the-signal-demo'),
|
||||||
);
|
);
|
||||||
|
final cardTitle = tester.widget<Text>(cardTitleFinder);
|
||||||
expect(cardTitle.style?.fontSize, AppDimens.cardTitleFont);
|
expect(cardTitle.style?.fontSize, AppDimens.cardTitleFont);
|
||||||
expect(cardTitle.style?.fontWeight, FontWeight.w500);
|
expect(cardTitle.style?.fontWeight, FontWeight.w500);
|
||||||
expect(cardTitle.style?.height, AppDimens.cardTitleLineHeight);
|
expect(cardTitle.style?.height, AppDimens.cardTitleLineHeight);
|
||||||
@@ -135,14 +136,18 @@ void main() {
|
|||||||
expect(badgeText.data, 'Hit');
|
expect(badgeText.data, 'Hit');
|
||||||
expect(badgeText.style?.fontSize, AppDimens.cardBadgeFont);
|
expect(badgeText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||||
expect(badgeText.style?.color, AppColors.textPrimary);
|
expect(badgeText.style?.color, AppColors.textPrimary);
|
||||||
final tags = tester.widget<Text>(
|
final tagsFinder = find.byKey(
|
||||||
find.byKey(const Key('recommend-tags-hits-the-signal-demo')),
|
const Key('recommend-tags-hits-the-signal-demo'),
|
||||||
);
|
);
|
||||||
|
final tags = tester.widget<Text>(tagsFinder);
|
||||||
expect(tags.data, 'Suspense | Mystery');
|
expect(tags.data, 'Suspense | Mystery');
|
||||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||||
expect(tags.style?.color, AppColors.textTertiary);
|
expect(tags.style?.color, AppColors.textTertiary);
|
||||||
expect(tester.getTopLeft(cardTitle).dx, tester.getTopLeft(coverFinder).dx);
|
expect(
|
||||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
tester.getTopLeft(cardTitleFinder).dx,
|
||||||
|
tester.getTopLeft(coverFinder).dx,
|
||||||
|
);
|
||||||
|
expect(tester.getTopLeft(tagsFinder).dx, tester.getTopLeft(coverFinder).dx);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_switch_inner_tabs_without_losing_grid_filter_state', (
|
testWidgets('should_switch_inner_tabs_without_losing_grid_filter_state', (
|
||||||
|
|||||||
Reference in new issue
Block a user