feat(player): 未就绪改由进度条展示加载态

This commit is contained in:
Zhou Weidong committed 2026-10-21 10:07:34 +08:00
1 parent 76cc52ad66
commit cf4b07aa69
12 files changed
+359 -167

No files matched your search

+12 -42
View File
@@ -18,7 +18,6 @@ import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
import 'package:fruitshorts/core/data/services/playback_session.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/core/widgets/remote_image.dart';
import 'package:fruitshorts/pages/auth/auth_view.dart';
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
@@ -132,15 +131,9 @@ void main() {
expect(player.playing, isTrue);
});
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'),
);
testWidgets('should_keep_video_surface_background_black', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
expect(
tester
@@ -150,6 +143,8 @@ void main() {
.color,
Colors.black,
);
expect(find.byKey(const Key('player-fallback-cover')), findsNothing);
expect(find.byKey(const Key('player-fallback-scrim')), findsNothing);
});
testWidgets('should_gate_comments_before_opening_sheet_when_signed_out', (
@@ -415,19 +410,9 @@ void main() {
expect(find.byKey(const Key('player-background')), findsNothing);
final fallback = find.byKey(const Key('player-fallback-background'));
expect(fallback, findsOneWidget);
expect(find.byKey(const Key('player-fallback-cover')), findsOneWidget);
expect(
tester
.widget<RemoteImage>(find.byKey(const Key('player-fallback-cover')))
.fallbackColor,
Colors.black,
);
expect(
tester
.widget<ColoredBox>(find.byKey(const Key('player-fallback-scrim')))
.color,
const Color(0x4D000000),
);
expect(tester.widget<ColoredBox>(fallback).color, Colors.black);
expect(find.byKey(const Key('player-fallback-cover')), findsNothing);
expect(find.byKey(const Key('player-fallback-scrim')), findsNothing);
expect(
tester
.widget<Scaffold>(find.byKey(const Key('player-scaffold')))
@@ -476,7 +461,8 @@ void main() {
tester.getSize(find.byKey(const Key('player-bottom-clear-screen'))),
const Size(40, 40),
);
expect(tester.widget<Slider>(find.byType(Slider)).padding, EdgeInsets.zero);
expect(find.byKey(const Key('progress-loading')), findsOneWidget);
expect(find.byType(Slider), findsNothing);
expect(bottom.height, lessThanOrEqualTo(200));
expect(bottom.top, greaterThanOrEqualTo(screenHeight * 0.78));
@@ -1092,7 +1078,8 @@ void _expectFullscreenOverlay(WidgetTester tester) {
expect(find.byKey(const Key('player-pip')), findsNothing);
expect(find.byKey(const Key('player-rail-comments')), findsOneWidget);
expect(find.byKey(const Key('player-fullscreen-toggle')), findsNothing);
expect(find.byType(Slider), findsOneWidget);
expect(find.byKey(const Key('progress-loading')), findsOneWidget);
expect(find.byType(Slider), findsNothing);
expect(find.byKey(const Key('player-title')), findsNothing);
expect(find.byKey(const Key('player-subtitle')), findsNothing);
expect(find.byKey(const Key('player-genre-chip')), findsNothing);
@@ -1211,20 +1198,3 @@ 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',
),
],
);