fix(player): 调整 rail 倍速弹窗与进度时间
This commit is contained in:
1 parent
87628e7d10
commit
4d7173d035
5 files changed
+88
-42
No files matched your search
@@ -683,37 +683,7 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
|
|||||||
key: const Key('player-controls-visible'),
|
key: const Key('player-controls-visible'),
|
||||||
children: [
|
children: [
|
||||||
_topBar(context),
|
_topBar(context),
|
||||||
Expanded(
|
const Spacer(),
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
right: 10,
|
|
||||||
bottom: 14,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
key: const Key('player-speed'),
|
|
||||||
onTap: widget.onSpeedTap,
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 4,
|
|
||||||
vertical: 2,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
_speedLabel(widget.playbackSpeed),
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Color(0xFFDDDDDD),
|
|
||||||
fontSize: 9,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
key: const Key('player-controls-bottom'),
|
key: const Key('player-controls-bottom'),
|
||||||
padding: const EdgeInsets.fromLTRB(14, 8, 14, 12),
|
padding: const EdgeInsets.fromLTRB(14, 8, 14, 12),
|
||||||
@@ -723,7 +693,7 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
|
|||||||
key: const Key('player-progress'),
|
key: const Key('player-progress'),
|
||||||
valueListenable: widget.controller,
|
valueListenable: widget.controller,
|
||||||
semanticsLabel: widget.l10n.seekVideo,
|
semanticsLabel: widget.l10n.seekVideo,
|
||||||
showTimes: false,
|
showTimes: true,
|
||||||
onScrubStart: widget.onScrubStart,
|
onScrubStart: widget.onScrubStart,
|
||||||
onSeek: widget.onSeek,
|
onSeek: widget.onSeek,
|
||||||
),
|
),
|
||||||
@@ -886,6 +856,28 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
ListTile(
|
||||||
|
key: const Key('player-more-speed'),
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.speed_rounded,
|
||||||
|
color: AppColors.secondary,
|
||||||
|
),
|
||||||
|
title: Text(widget.l10n.playbackSpeed),
|
||||||
|
trailing: Text(
|
||||||
|
_speedLabel(widget.playbackSpeed),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: AppColors.blue,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(sheetContext);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (mounted) widget.onSpeedTap();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
key: const Key('player-more-download'),
|
key: const Key('player-more-download'),
|
||||||
leading: const Icon(
|
leading: const Icon(
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class HomeFeedOverlay extends StatelessWidget {
|
|||||||
_header(context),
|
_header(context),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: const Alignment(1.0, 0.45),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 0, 12, 16),
|
padding: const EdgeInsets.fromLTRB(0, 0, 12, 16),
|
||||||
child: _rail(),
|
child: _rail(),
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ void main() {
|
|||||||
find.byKey(const Key('home-feed-episode')),
|
find.byKey(const Key('home-feed-episode')),
|
||||||
);
|
);
|
||||||
expect(episodeRect.left, lessThan(cardRect.center.dx));
|
expect(episodeRect.left, lessThan(cardRect.center.dx));
|
||||||
|
final railCenter = tester.getCenter(find.byKey(const Key('rail-like')));
|
||||||
|
final railBottom = tester.getBottomLeft(find.byKey(const Key('rail-save')));
|
||||||
|
expect(railCenter.dy, greaterThan(844 * 0.4));
|
||||||
|
expect(railBottom.dy, lessThan(cardRect.top));
|
||||||
expect(find.byKey(const Key('home-feed-follow-series')), findsOneWidget);
|
expect(find.byKey(const Key('home-feed-follow-series')), findsOneWidget);
|
||||||
expect(find.byKey(const Key('home-feed-episodes')), findsOneWidget);
|
expect(find.byKey(const Key('home-feed-episodes')), findsOneWidget);
|
||||||
for (final key in const [Key('home-feed-search'), Key('home-feed-more')]) {
|
for (final key in const [Key('home-feed-search'), Key('home-feed-more')]) {
|
||||||
|
|||||||
@@ -56,11 +56,13 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(started, 1);
|
expect(started, 1);
|
||||||
expect(target, isNull);
|
expect(target, isNull);
|
||||||
|
expect(find.textContaining('/ 00:12'), findsOneWidget);
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(target, isNotNull);
|
expect(target, isNotNull);
|
||||||
expect(target!, greaterThan(const Duration(seconds: 3)));
|
expect(target!, greaterThan(const Duration(seconds: 3)));
|
||||||
expect(target!, lessThan(const Duration(seconds: 12)));
|
expect(target!, lessThan(const Duration(seconds: 12)));
|
||||||
|
expect(find.textContaining('/ 00:12'), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_show_time_only_while_dragging_when_seek_bar_is_compact', (
|
testWidgets('should_show_time_only_while_dragging_when_seek_bar_is_compact', (
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
|
|||||||
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
|
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
|
||||||
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
||||||
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
|
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
|
||||||
|
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
|
||||||
|
|
||||||
import '../support/fake_catalog.dart';
|
import '../support/fake_catalog.dart';
|
||||||
import '../support/fake_category.dart';
|
import '../support/fake_category.dart';
|
||||||
@@ -260,8 +261,10 @@ void main() {
|
|||||||
await tester.tap(find.byKey(const Key('detail-cta')));
|
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('1.0x'), findsOneWidget);
|
await tester.tap(find.byKey(const Key('player-more')));
|
||||||
await tester.tap(find.byKey(const Key('player-speed')));
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byKey(const Key('player-more-speed')), findsOneWidget);
|
||||||
|
await tester.tap(find.byKey(const Key('player-more-speed')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.byKey(const Key('player-speed-sheet')), findsOneWidget);
|
expect(find.byKey(const Key('player-speed-sheet')), findsOneWidget);
|
||||||
@@ -273,7 +276,15 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.byKey(const Key('player-speed-sheet')), findsNothing);
|
expect(find.byKey(const Key('player-speed-sheet')), findsNothing);
|
||||||
expect(find.text('1.5x'), findsOneWidget);
|
await tester.tap(find.byKey(const Key('player-more')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byKey(const Key('player-more-speed')),
|
||||||
|
matching: find.text('1.5x'),
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_hide_speed_entry_in_clear_screen_and_keep_speed', (
|
testWidgets('should_hide_speed_entry_in_clear_screen_and_keep_speed', (
|
||||||
@@ -289,24 +300,61 @@ void main() {
|
|||||||
await tester.tap(find.byKey(const Key('detail-cta')));
|
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('player-speed')));
|
await tester.tap(find.byKey(const Key('player-more')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.byKey(const Key('player-more-speed')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.byKey(const Key('player-speed-1.5')));
|
await tester.tap(find.byKey(const Key('player-speed-1.5')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('1.5x'), findsOneWidget);
|
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('player-clear-screen')));
|
await tester.tap(find.byKey(const Key('player-clear-screen')));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byKey(const Key('player-speed')), findsNothing);
|
expect(find.byKey(const Key('player-more')), findsNothing);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
|
await tester.tap(find.byKey(const Key('player-exit-clear-screen')));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byKey(const Key('player-speed')), findsOneWidget);
|
await tester.tap(find.byKey(const Key('player-more')));
|
||||||
expect(find.text('1.5x'), findsOneWidget);
|
await tester.pumpAndSettle();
|
||||||
|
expect(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byKey(const Key('player-more-speed')),
|
||||||
|
matching: find.text('1.5x'),
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
await tester.binding.handlePopRoute();
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
await tester.drag(find.byType(PageView), const Offset(0, -550));
|
await tester.drag(find.byType(PageView), const Offset(0, -550));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('1.5x'), findsOneWidget);
|
await tester.tap(find.byKey(const Key('player-more')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byKey(const Key('player-more-speed')),
|
||||||
|
matching: find.text('1.5x'),
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('should_enable_drag_time_preview_on_player_progress', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
await _pumpApp(tester);
|
||||||
|
await tester.binding.handlePopRoute();
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.binding.handlePopRoute();
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.byKey(const Key('drawer-open-series')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
final bar = tester.widget<SeekProgressBar>(
|
||||||
|
find.byKey(const Key('player-progress')),
|
||||||
|
);
|
||||||
|
expect(bar.showTimes, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('should_clear_and_restore_home_feed_chrome', (tester) async {
|
testWidgets('should_clear_and_restore_home_feed_chrome', (tester) async {
|
||||||
|
|||||||
Reference in new issue
Block a user