fix(flutter): 清屏态进度可拖动并长按恢复播放

This commit is contained in:
Zhou Weidong committed 2026-10-20 14:38:09 +08:00
1 parent 8327c1dd13
commit b2c219d6bd
3 files changed
+103 -9

No files matched your search

+79
View File
@@ -379,4 +379,83 @@ void main() {
expect(find.byKey(const Key('home-feed-refreshing')), findsNothing);
expect(find.byIcon(Icons.refresh_rounded), findsOneWidget);
});
testWidgets('should_seek_from_series_bar_when_overlay_is_cleared', (
tester,
) async {
Duration? seeked;
final controller = ValueNotifier<VideoPlayerValue>(
VideoPlayerValue(
duration: const Duration(seconds: 100),
position: const Duration(seconds: 10),
isInitialized: true,
),
);
addTearDown(controller.dispose);
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
locale: const Locale('en'),
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: AppLocalizations.localizationsDelegates,
home: Builder(
builder: (context) => Scaffold(
body: HomeFeedOverlay(
l10n: AppLocalizations.of(context)!,
drama: const Drama(
id: 'clear-drama',
title: 'Clear Drama',
synopsis: 'synopsis',
posterUrl: '',
totalEpisodes: 8,
),
episode: const Episode(
id: 'clear-episode',
number: 1,
title: 'Episode 1',
isFree: true,
),
controller: controller,
liked: false,
saved: false,
visible: false,
boosting: false,
onTogglePlay: () {},
onBoostStart: () {},
onBoostEnd: () {},
onLike: () {},
onSave: () {},
onComments: () {},
onShare: () {},
onEpisodes: () {},
onDetail: () {},
onOpenFullPlayer: () {},
onRefreshFeed: () async => true,
onDownload: () {},
onClear: () {},
onSearch: () {},
onMore: () {},
onScrubStart: () {},
onSeek: (value) => seeked = value,
),
),
),
),
);
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-feed-refresh')), findsOneWidget);
expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget);
expect(find.byKey(const Key('home-feed-progress')), findsOneWidget);
final gesture = await tester.startGesture(
tester.getCenter(find.byKey(const Key('home-feed-progress'))),
);
await gesture.moveBy(const Offset(80, 0));
await gesture.up();
await tester.pumpAndSettle();
expect(seeked, isNotNull);
expect(seeked!.inSeconds, greaterThan(0));
});
}
+22
View File
@@ -178,6 +178,28 @@ void main() {
expect(find.byKey(const Key('rail-save')), findsOneWidget);
});
testWidgets('should_resume_playback_when_boosting_while_paused', (
tester,
) async {
await _pumpApp(tester);
await tester.tap(find.byKey(const Key('home-feed-video-toggle')));
await tester.pump();
expect(find.byKey(const Key('home-feed-center-play')), findsOneWidget);
final gesture = await tester.startGesture(const Offset(60, 300));
await tester.pump(const Duration(milliseconds: 700));
await tester.pump();
expect(find.byKey(const Key('home-feed-speed-boost-hint')), findsOneWidget);
expect(find.textContaining('2.0'), findsWidgets);
expect(find.byKey(const Key('home-feed-center-play')), findsNothing);
await gesture.up();
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-feed-speed-boost-hint')), findsNothing);
expect(find.byKey(const Key('home-feed-center-play')), findsNothing);
});
testWidgets('should_open_more_sheet_on_center_long_press', (tester) async {
await _pumpApp(tester);