feat(app): 客户端展示多语言并支持筛选分页
This commit is contained in:
1 parent
8481611372
commit
8b50b5bd06
68 files changed
+2742
-1120
No files matched your search
@@ -21,6 +21,8 @@ void main() {
|
||||
title: 'A very long home grid drama title that must wrap',
|
||||
dramaType: 'ANIME',
|
||||
viewCount: 444500,
|
||||
tag: '漫剧',
|
||||
tagLocales: const {'zh': '漫剧', 'en': 'Anime', 'id': 'Anime'},
|
||||
),
|
||||
onTap: () => taps++,
|
||||
);
|
||||
@@ -52,7 +54,7 @@ void main() {
|
||||
BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||
);
|
||||
final badge = find.byKey(
|
||||
const Key('drama-cover-badge-ribbon-anime-card-anime'),
|
||||
const Key('drama-cover-badge-ribbon-anime-card-tag'),
|
||||
);
|
||||
expect(badge, findsOneWidget);
|
||||
expect(
|
||||
@@ -120,10 +122,7 @@ void main() {
|
||||
expect(taps, 1);
|
||||
});
|
||||
|
||||
testWidgets('should_choose_anime_new_and_hot_badges_from_real_data', (
|
||||
tester,
|
||||
) async {
|
||||
final now = DateTime(2026, 10, 22, 12);
|
||||
testWidgets('should_show_cover_badge_from_tag_locale', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.dark(),
|
||||
@@ -134,18 +133,18 @@ void main() {
|
||||
body: Row(
|
||||
children: [
|
||||
for (final drama in [
|
||||
_drama(id: 'anime', title: 'Anime', dramaType: 'ANIME'),
|
||||
_drama(
|
||||
id: 'new',
|
||||
title: 'New',
|
||||
createdAt: now.subtract(const Duration(days: 2)),
|
||||
id: 'tagged',
|
||||
title: 'Tagged',
|
||||
tag: '新剧',
|
||||
tagLocales: const {'zh': '新剧', 'en': 'New', 'id': 'Baru'},
|
||||
),
|
||||
_drama(id: 'hot', title: 'Hot', isHot: true),
|
||||
_drama(id: 'plain', title: 'Plain'),
|
||||
])
|
||||
SizedBox(
|
||||
width: 130,
|
||||
height: 240,
|
||||
child: HomeFeedCard(drama: drama, onTap: () {}, now: now),
|
||||
child: HomeFeedCard(drama: drama, onTap: () {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -154,18 +153,10 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-anime-anime')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-new-newRelease')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-hot-hot')),
|
||||
findsOneWidget,
|
||||
);
|
||||
final badge = find.byKey(const Key('drama-cover-badge-ribbon-tagged-tag'));
|
||||
expect(badge, findsOneWidget);
|
||||
expect(find.text('New'), findsOneWidget);
|
||||
expect(find.byKey(const Key('drama-cover-badge-ribbon-plain-tag')), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,6 +167,8 @@ Drama _drama({
|
||||
int viewCount = 0,
|
||||
bool isHot = false,
|
||||
DateTime? createdAt,
|
||||
String tag = '',
|
||||
Map<String, String> tagLocales = const {},
|
||||
}) {
|
||||
return Drama(
|
||||
id: id,
|
||||
@@ -188,6 +181,8 @@ Drama _drama({
|
||||
isHot: isHot,
|
||||
dramaType: dramaType,
|
||||
createdAt: createdAt,
|
||||
tag: tag,
|
||||
tagLocales: tagLocales,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -210,7 +205,6 @@ Future<void> _pumpCard(
|
||||
child: HomeFeedCard(
|
||||
drama: drama,
|
||||
onTap: onTap,
|
||||
now: DateTime(2026, 10, 22, 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user