style(client): 对齐短剧列表字号与间距
This commit is contained in:
1 parent
d03dcf162e
commit
d7a59e5a27
17 files changed
+576
-148
No files matched your search
@@ -40,9 +40,19 @@ 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 badge = find.byKey(const Key('home-feed-badge-anime-anime-card'));
|
||||
expect(badge, findsOneWidget);
|
||||
final badgeContainer = tester.widget<Container>(badge);
|
||||
expect(
|
||||
find.byKey(const Key('home-feed-badge-anime-anime-card')),
|
||||
findsOneWidget,
|
||||
(badgeContainer.decoration! as BoxDecoration).borderRadius,
|
||||
BorderRadius.circular(AppDimens.cardBadgeRadius),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.widget<Text>(find.descendant(of: badge, matching: find.byType(Text)))
|
||||
.style
|
||||
?.fontSize,
|
||||
AppDimens.cardBadgeFont,
|
||||
);
|
||||
expect(find.text('Anime'), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-views-anime-card')), findsOneWidget);
|
||||
@@ -51,16 +61,31 @@ void main() {
|
||||
find.descendant(of: views, matching: find.byType(Text)),
|
||||
);
|
||||
expect(viewsText.data, startsWith('44.'));
|
||||
expect(
|
||||
tester
|
||||
.widget<Text>(find.byKey(const Key('home-feed-title-anime-card')))
|
||||
.maxLines,
|
||||
2,
|
||||
expect(viewsText.style?.fontSize, AppDimens.cardViewsFont);
|
||||
expect(viewsText.style?.color, AppColors.navSelected);
|
||||
final title = tester.widget<Text>(
|
||||
find.byKey(const Key('home-feed-title-anime-card')),
|
||||
);
|
||||
expect(find.byKey(const Key('home-feed-tag-anime-card-0')), findsOneWidget);
|
||||
expect(title.maxLines, 2);
|
||||
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
||||
expect(title.style?.fontWeight, FontWeight.w500);
|
||||
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
||||
final firstTag = find.byKey(const Key('home-feed-tag-anime-card-0'));
|
||||
expect(firstTag, findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-tag-anime-card-1')), findsOneWidget);
|
||||
expect(find.text('Romance'), findsOneWidget);
|
||||
expect(find.text('Urban'), findsOneWidget);
|
||||
final tagContainer = tester.widget<Container>(firstTag);
|
||||
expect(tester.getSize(firstTag).height, AppDimens.cardTagHeight);
|
||||
expect(
|
||||
(tagContainer.decoration! as BoxDecoration).borderRadius,
|
||||
BorderRadius.circular(AppDimens.cardTagRadius),
|
||||
);
|
||||
final tagText = tester.widget<Text>(
|
||||
find.descendant(of: firstTag, matching: find.byType(Text)),
|
||||
);
|
||||
expect(tagText.style?.fontSize, AppDimens.cardTagFont);
|
||||
expect(tagText.style?.color, AppColors.textTertiary);
|
||||
|
||||
await tester.tap(card);
|
||||
expect(taps, 1);
|
||||
|
||||
@@ -16,6 +16,8 @@ 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/data/services/playback_thumbnail_service.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/theme/app_dimens.dart';
|
||||
import 'package:fruitshorts/core/theme/app_theme.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/home/home_feed_channel.dart';
|
||||
@@ -82,8 +84,8 @@ void main() {
|
||||
final delegate =
|
||||
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
|
||||
expect(delegate.crossAxisCount, 3);
|
||||
expect(delegate.crossAxisSpacing, 8);
|
||||
expect(delegate.mainAxisSpacing, 8);
|
||||
expect(delegate.crossAxisSpacing, AppDimens.homeGridGap);
|
||||
expect(delegate.mainAxisSpacing, AppDimens.homeGridRowGap);
|
||||
expect(find.byKey(const Key('home-section-featured')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-section-new')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-section-categories')), findsOneWidget);
|
||||
@@ -92,6 +94,67 @@ void main() {
|
||||
expect(find.byKey(const Key('home-section-category-社群')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-grid-filter')), findsOneWidget);
|
||||
final searchBox = find.descendant(
|
||||
of: find.byKey(const Key('home-search-entry')),
|
||||
matching: find.byType(Container),
|
||||
);
|
||||
expect(tester.getSize(searchBox).height, AppDimens.searchHeight);
|
||||
expect(
|
||||
(tester.widget<Container>(searchBox).decoration! as BoxDecoration)
|
||||
.borderRadius,
|
||||
BorderRadius.circular(AppDimens.searchRadius),
|
||||
);
|
||||
final placeholder = tester.widget<Text>(
|
||||
find.text('Search dramas, actors, genres...'),
|
||||
);
|
||||
expect(placeholder.style?.fontSize, AppDimens.searchPlaceholderFont);
|
||||
expect(placeholder.style?.color, AppColors.textSecondary);
|
||||
final selectedPrimary = tester.widget<Text>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-section-featured')),
|
||||
matching: find.text('Featured'),
|
||||
),
|
||||
);
|
||||
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')),
|
||||
matching: find.text('Hot'),
|
||||
),
|
||||
);
|
||||
expect(secondaryTag.style?.fontSize, AppDimens.homeSecondaryTagFont);
|
||||
expect(secondaryTag.style?.fontWeight, FontWeight.w400);
|
||||
expect(secondaryTag.style?.color, AppColors.textTertiary);
|
||||
final unselectedTagChip = 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,
|
||||
);
|
||||
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')),
|
||||
matching: find.text('Hot'),
|
||||
),
|
||||
);
|
||||
expect(selectedTag.style?.color, AppColors.navSelected);
|
||||
expect(selectedTag.style?.fontWeight, FontWeight.w700);
|
||||
expect(find.byType(PageView), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
@@ -128,10 +191,7 @@ void main() {
|
||||
expect(find.byKey(const Key('recommend-page')), findsOneWidget);
|
||||
expect(find.byKey(const Key('recommend-feed-player')), findsOneWidget);
|
||||
expect(find.byType(PlayerPage), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<PlayerPage>(find.byType(PlayerPage)).homeMode,
|
||||
isTrue,
|
||||
);
|
||||
expect(tester.widget<PlayerPage>(find.byType(PlayerPage)).homeMode, isTrue);
|
||||
expect(find.byKey(const Key('recommend-section-hits')), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
|
||||
|
||||
Reference in new issue
Block a user