merge: 合并 K33-J 清屏进度与长按恢复

This commit is contained in:
Zhou Weidong committed 2026-10-20 14:38:12 +08:00
commit 33de925f65
3 files changed
+103 -9

No files matched your search

+2 -9
View File
@@ -142,6 +142,8 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
/// 长按两侧:切 2 倍速并清屏,记下进入前的状态用于松手恢复。
void _startBoost() {
if (_boosting) return;
// 暂停时长按两侧先恢复播放,再进入 2 倍速。
if (!logic.session.userWantsPlay) logic.session.setUserWantsPlay(true);
setState(() {
_boosting = true;
_speedBeforeBoost = _playbackSpeed;
@@ -499,15 +501,6 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
? null
: () => _openUnlockSheet(context, index, episode),
),
if (widget.homeMode && !_chromeVisible)
Positioned.fill(
child: GestureDetector(
key: const Key('home-feed-video-tap'),
behavior: HitTestBehavior.opaque,
onTap: () =>
logic.session.setUserWantsPlay(!logic.session.userWantsPlay),
),
),
if (widget.homeMode && !_chromeVisible)
Positioned(
right: 12,
+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);