fix(player): 优化加载指示器与锁定进度条
This commit is contained in:
1 parent
7b068e8eb4
commit
623c184243
13 files changed
+393
-33
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
@@ -34,6 +35,47 @@ void main() {
|
||||
expect(find.byType(Slider), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_show_inactive_track_and_disable_seek_when_locked', (
|
||||
tester,
|
||||
) async {
|
||||
final video = ValueNotifier<VideoPlayerValue>(
|
||||
const VideoPlayerValue(
|
||||
duration: Duration(seconds: 12),
|
||||
position: Duration(seconds: 3),
|
||||
isInitialized: true,
|
||||
),
|
||||
);
|
||||
addTearDown(video.dispose);
|
||||
var seeks = 0;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SeekProgressBar(
|
||||
valueListenable: video,
|
||||
semanticsLabel: 'Seek video',
|
||||
locked: true,
|
||||
onSeek: (_) async => seeks++,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
expect(find.byKey(const Key('progress-loading-highlight')), findsNothing);
|
||||
expect(find.byType(Slider), findsNothing);
|
||||
final inactive = tester.widget<ColoredBox>(
|
||||
find.byKey(const Key('progress-inactive')),
|
||||
);
|
||||
expect(inactive.color, AppColors.border);
|
||||
|
||||
await tester.drag(
|
||||
find.byKey(const Key('progress-inactive')),
|
||||
const Offset(120, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(seeks, 0);
|
||||
});
|
||||
|
||||
testWidgets('should_debounce_buffering_before_showing_loading_track', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in new issue
Block a user