fix(flutter): 收窄清屏范围并保留底栏

This commit is contained in:
Zhou Weidong committed 2026-10-20 11:33:23 +08:00
1 parent a26b0071e4
commit 3068eb99da
2 files changed
+136 -134

No files matched your search

+38 -37
View File
@@ -110,8 +110,10 @@ void main() {
await _clearFromMore(tester);
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsNothing);
expect(find.byKey(const Key('player-bottom-actions')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsNothing);
expect(find.byType(PlayerCenterToggle), findsOneWidget);
expect(
tester
@@ -122,45 +124,30 @@ void main() {
isFalse,
);
expect(find.byKey(const Key('player-video-tap')), findsOneWidget);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(find.byKey(const Key('player-bottom-clear-screen')), findsOneWidget);
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
expect(
tester.getSize(find.byKey(const Key('player-exit-clear-screen'))),
const Size(36, 36),
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
const Size(30, 30),
);
await tester.tapAt(const Offset(80, 300));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-bottom-actions')), findsOneWidget);
expect(find.byType(PlayerCenterToggle), findsNothing);
await tester.tapAt(const Offset(80, 300));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(
tester
.widget<PlayerCenterToggle>(
find.byKey(const Key('player-play-toggle')),
)
.playing,
isFalse,
);
expect(find.byType(PlayerCenterToggle), findsOneWidget);
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
await tester.tap(find.byKey(const Key('player-bottom-clear-screen')));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsOneWidget);
expect(find.byType(PlayerCenterToggle), findsOneWidget);
expect(
tester
.widget<PlayerCenterToggle>(
find.byKey(const Key('player-play-toggle')),
)
.playing,
isFalse,
);
expect(find.byKey(const Key('player-exit-clear-screen')), findsNothing);
expect(find.byTooltip('Clear screen'), findsOneWidget);
});
testWidgets('should_fit_player_header_on_320_width', (tester) async {
@@ -251,20 +238,22 @@ void main() {
await _clearFromMore(tester);
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
await tester.drag(find.byType(PageView), const Offset(0, -550));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsNothing);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(find.byKey(const Key('player-bottom-actions')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsNothing);
expect(find.byKey(const Key('player-bottom-clear-screen')), findsOneWidget);
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
await tester.tap(find.byKey(const Key('player-bottom-clear-screen')));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
expect(find.byKey(const Key('player-exit-clear-screen')), findsNothing);
expect(find.byKey(const Key('player-interaction-rail')), findsOneWidget);
});
testWidgets('should_open_speed_sheet_and_apply_selected_speed', (
@@ -309,9 +298,9 @@ void main() {
await _clearFromMore(tester);
await tester.pump();
expect(find.byKey(const Key('player-more')), findsNothing);
expect(find.byKey(const Key('player-more')), findsOneWidget);
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
await tester.tap(find.byKey(const Key('player-bottom-clear-screen')));
await tester.pump();
await tester.drag(find.byType(PageView), const Offset(0, -550));
await tester.pumpAndSettle();
@@ -448,9 +437,11 @@ void main() {
await tester.tap(find.byKey(const Key('player-more-clear')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsNothing);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(find.byKey(const Key('player-bottom-actions')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsNothing);
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
});
testWidgets('should_enter_clear_screen_from_bottom_button', (tester) async {
@@ -462,9 +453,19 @@ void main() {
await tester.tap(find.byKey(const Key('player-bottom-clear-screen')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsNothing);
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
expect(find.byKey(const Key('player-bottom-actions')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsNothing);
expect(find.byType(PlayerCenterToggle), findsNothing);
expect(find.byTooltip('Exit clear screen'), findsOneWidget);
await tester.tap(find.byKey(const Key('player-bottom-clear-screen')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
expect(find.byKey(const Key('player-interaction-rail')), findsOneWidget);
expect(find.byType(PlayerCenterToggle), findsNothing);
expect(find.byTooltip('Clear screen'), findsOneWidget);
});
testWidgets('should_open_unlock_panel_with_honest_method_states', (