fix(player): 优化加载指示器与锁定进度条

This commit is contained in:
Zhou Weidong committed 2026-10-22 10:09:33 +08:00
1 parent 7b068e8eb4
commit 623c184243
13 files changed
+393 -33

No files matched your search

+78
View File
@@ -106,6 +106,7 @@ void main() {
isFree: true,
),
controller: null,
locked: false,
liked: true,
saved: false,
visible: true,
@@ -183,6 +184,80 @@ void main() {
expect(find.byKey(const Key('home-feed-progress-thumb')), findsNothing);
});
testWidgets('should_show_static_track_without_seek_when_feed_is_locked', (
tester,
) async {
var scrubStarts = 0;
var seeks = 0;
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: 'locked-feed',
title: 'Locked Feed',
synopsis: 'synopsis',
posterUrl: '',
),
episode: const Episode(
id: 'locked-feed-1',
number: 1,
title: 'Locked',
isFree: false,
locked: true,
),
controller: null,
locked: true,
liked: false,
saved: false,
visible: true,
boosting: false,
onTogglePlay: () {},
onBoostStart: () {},
onBoostEnd: () {},
onLike: () {},
onSave: () {},
onComments: () {},
onShare: () {},
onDetail: () {},
onOpenFullPlayer: () {},
onMore: () {},
onScrubStart: () => scrubStarts++,
onSeek: (_) => seeks++,
),
),
),
),
);
expect(find.byKey(const Key('progress-loading')), findsNothing);
expect(find.byKey(const Key('progress-loading-highlight')), findsNothing);
expect(
find.byKey(const Key('home-feed-progress-inactive')),
findsOneWidget,
);
expect(
tester
.getSize(find.byKey(const Key('home-feed-progress-inactive')))
.height,
2,
);
await tester.drag(
find.byKey(const Key('home-feed-progress')),
const Offset(120, 0),
);
await tester.pumpAndSettle();
expect(scrubStarts, 0);
expect(seeks, 0);
});
testWidgets('should_seek_and_open_player_from_feed_actions', (tester) async {
var opened = 0;
Duration? seeked;
@@ -219,6 +294,7 @@ void main() {
isFree: true,
),
controller: controller,
locked: false,
liked: false,
saved: false,
visible: true,
@@ -355,6 +431,7 @@ void main() {
isFree: true,
),
controller: controller,
locked: false,
liked: false,
saved: false,
visible: true,
@@ -505,6 +582,7 @@ void main() {
isFree: true,
),
controller: controller,
locked: false,
liked: false,
saved: false,
visible: false,