feat(flutter): 重构播放页并增加语言切换

This commit is contained in:
Zhou Weidong committed 2026-10-20 11:01:38 +08:00
1 parent f1efbc5be8
commit 8c43e9e385
34 files changed
+1331 -879

No files matched your search

+29 -7
View File
@@ -72,7 +72,7 @@ void main() {
await tester.pumpAndSettle();
expect(
tester.widget<Text>(find.byKey(const Key('player-title'))).data,
tester.widget<Text>(find.byKey(const Key('player-episode-heading'))).data,
contains('Episode 2'),
);
expect(created, hasLength(3));
@@ -135,9 +135,7 @@ void main() {
);
});
testWidgets('should_follow_system_locale_without_language_switch', (
tester,
) async {
testWidgets('should_show_language_entry_on_mine_page', (tester) async {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
expect(find.byTooltip('Captions'), findsNothing);
@@ -146,7 +144,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Vicky sheng'), findsOneWidget);
expect(find.text('Coins'), findsOneWidget);
expect(find.text('App Language'), findsNothing);
expect(find.byKey(const Key('mine-language')), findsOneWidget);
expect(find.byKey(const Key('mine-wallet')), findsOneWidget);
await tester.tap(find.byKey(const Key('tab-theater')));
@@ -154,6 +152,30 @@ void main() {
expect(find.text('Theater'), findsWidgets);
});
testWidgets('should_switch_app_language_from_mine_menu', (tester) async {
await tester.pumpWidget(appUnderTest());
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('tab-mine')));
await tester.pumpAndSettle();
await tester.drag(
find.byKey(const Key('mine-page-scroll')),
const Offset(0, -320),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('mine-language')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('mine-language-sheet')), findsOneWidget);
await tester.tap(find.byKey(const Key('mine-language-zh')));
await tester.pumpAndSettle();
expect(find.text('我的'), findsWidgets);
expect(find.text('语言'), findsOneWidget);
await tester.tap(find.byKey(const Key('tab-theater')));
await tester.pumpAndSettle();
expect(find.text('剧场'), findsWidgets);
});
testWidgets('should_fit_compact_viewport_when_player_is_opened', (
tester,
) async {
@@ -170,7 +192,7 @@ void main() {
await tester.drag(find.byType(PageView), const Offset(0, -500));
await tester.pumpAndSettle();
expect(
tester.widget<Text>(find.byKey(const Key('player-title'))).data,
tester.widget<Text>(find.byKey(const Key('player-episode-heading'))).data,
contains('Episode 2'),
);
expect(tester.takeException(), isNull);
@@ -191,7 +213,7 @@ void main() {
expect(find.byKey(const Key('discover-search')), findsOneWidget);
expect(find.byKey(const Key('theater-category-chips')), findsOneWidget);
expect(find.byKey(const Key('theater-language-chips')), findsOneWidget);
expect(find.byKey(const Key('theater-language-chips')), findsNothing);
expect(find.byKey(const Key('home-all-dramas-grid')), findsOneWidget);
expect(find.byKey(const Key('discover-profile')), findsOneWidget);
expect(tester.takeException(), isNull);