fix(flutter): 优化播放加载占位与主题色

This commit is contained in:
Zhou Weidong committed 2026-10-20 15:59:23 +08:00
1 parent 9864c8e102
commit fa5fd124a4
2 files changed
+86 -10

No files matched your search

+45 -3
View File
@@ -49,6 +49,26 @@ void main() {
expect(tester.takeException(), isNull);
});
testWidgets('should_fall_back_to_black_when_poster_is_empty', (tester) async {
await _pumpApp(
tester,
catalog: FakeCatalogRepository(dramas: const [_noCoverDrama]),
);
await _openSeriesPlayer(
tester,
cardKey: const Key('home-drama-card-no-cover-demo'),
);
expect(
tester
.widget<ColoredBox>(
find.byKey(const Key('player-fallback-background')),
)
.color,
Colors.black,
);
});
testWidgets('should_show_center_toggle_only_when_paused', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
@@ -283,9 +303,14 @@ void main() {
);
expect(find.byKey(const Key('player-background')), findsNothing);
final fallback = find.byKey(const Key('player-fallback-background'));
if (fallback.evaluate().isNotEmpty) {
expect(tester.widget<ColoredBox>(fallback).color, Colors.black);
}
expect(fallback, findsOneWidget);
expect(find.byKey(const Key('player-fallback-cover')), findsOneWidget);
expect(
tester
.widget<ColoredBox>(find.byKey(const Key('player-fallback-scrim')))
.color,
const Color(0x66000000),
);
expect(
tester
.widget<Scaffold>(find.byKey(const Key('player-scaffold')))
@@ -1024,3 +1049,20 @@ const _lockedDrama = Drama(
),
],
);
const _noCoverDrama = Drama(
id: 'no-cover-demo',
title: 'No Cover Demo',
synopsis: 'No cover synopsis',
posterUrl: '',
detailLoaded: true,
episodes: [
Episode(
id: 'no-cover-demo-1',
number: 1,
title: 'No Cover Episode',
isFree: true,
videoUrl: 'https://example.test/no-cover-demo-1.mp4',
),
],
);