fix(player): 统一暂停按钮并自动隐藏控制层

This commit is contained in:
Zhou Weidong committed 2026-10-19 16:16:14 +08:00
1 parent 568f051b7a
commit 03e34b3b57
5 files changed
+353 -171

No files matched your search

+34
View File
@@ -10,6 +10,7 @@ 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/pages/player/player_view.dart';
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
import '../support/fake_catalog.dart';
import '../support/fake_category.dart';
@@ -90,6 +91,39 @@ void main() {
expect(find.byIcon(Icons.play_arrow_rounded), findsOneWidget);
});
testWidgets('should_hide_controls_after_2_5s_and_reveal_on_video_tap', (
tester,
) async {
await _pumpApp(tester);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('drawer-open-series')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('detail-cta')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
expect(find.byType(PlayerCenterToggle), findsOneWidget);
await tester.pump(const Duration(milliseconds: 2600));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsNothing);
expect(find.byKey(const Key('player-controls-bottom')), findsNothing);
expect(find.byType(PlayerCenterToggle), findsNothing);
expect(find.byKey(const Key('player-video-tap')), findsOneWidget);
await tester.tap(find.byKey(const Key('player-video-tap')));
await tester.pump();
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
expect(find.byType(PlayerCenterToggle), findsOneWidget);
});
test('should_only_show_feed_pause_indicator_in_home_mode', () {
expect(
shouldShowFeedPauseIndicator(