fix(recommend): 精简底部信息并优化进度拖动
This commit is contained in:
1 parent
ccda41b15b
commit
d66ac8327e
16 files changed
+141
-163
No files matched your search
@@ -23,6 +23,7 @@ import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/home/home_feed_channel.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/home_feed_header.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/home_feed_overlay.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/scrub_preview_card.dart';
|
||||
import 'package:fruitshorts/pages/player/player_view.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
@@ -355,6 +356,23 @@ void main() {
|
||||
'Ignored Episode Title',
|
||||
);
|
||||
expect(find.text('Feed Drama'), findsOneWidget);
|
||||
final seriesTitle = tester.widget<Text>(find.text('Feed Drama'));
|
||||
expect(seriesTitle.style?.fontSize, 19);
|
||||
expect(seriesTitle.style?.fontWeight, FontWeight.w600);
|
||||
expect(seriesTitle.style?.color, AppColors.textPrimary);
|
||||
final seriesChevron = tester.widget<Icon>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('home-feed-series-name')),
|
||||
matching: find.byIcon(Icons.chevron_right_rounded),
|
||||
),
|
||||
);
|
||||
expect(seriesChevron.size, 20);
|
||||
expect(seriesChevron.color, AppColors.textPrimary);
|
||||
expect(
|
||||
tester.getTopLeft(find.byIcon(Icons.chevron_right_rounded)).dx -
|
||||
tester.getTopRight(find.text('Feed Drama')).dx,
|
||||
4,
|
||||
);
|
||||
expect(find.byKey(const Key('home-feed-info-card')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-tags')), findsOneWidget);
|
||||
@@ -371,16 +389,27 @@ void main() {
|
||||
.data,
|
||||
'Episode 2 / 8 total',
|
||||
);
|
||||
expect(find.textContaining('41.9w'), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-ranking-pill')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-view-pill')), findsOneWidget);
|
||||
expect(find.text('Trending'), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-meta-pills')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-ranking-pill')), findsNothing);
|
||||
expect(find.byKey(const Key('home-feed-view-pill')), findsNothing);
|
||||
expect(find.text('Romance Urban'), findsOneWidget);
|
||||
final genreText = tester.widget<Text>(find.text('Romance Urban'));
|
||||
expect(genreText.style?.fontSize, 13);
|
||||
expect(genreText.style?.color, AppColors.overlayLabel);
|
||||
final episodeProgress = tester.widget<Text>(
|
||||
find.byKey(const Key('home-feed-episode-progress')),
|
||||
);
|
||||
expect(episodeProgress.maxLines, 1);
|
||||
expect(episodeProgress.softWrap, isFalse);
|
||||
expect(episodeProgress.style?.fontSize, 13);
|
||||
expect(episodeProgress.style?.color, AppColors.overlayLabel);
|
||||
expect(
|
||||
tester
|
||||
.getTopLeft(find.byKey(const Key('home-feed-episode-progress')))
|
||||
.dx -
|
||||
tester.getTopRight(find.text('Romance Urban')).dx,
|
||||
8,
|
||||
);
|
||||
expect(
|
||||
tester.widget<Text>(find.byKey(const Key('rail-like-count'))).data,
|
||||
'1006',
|
||||
@@ -567,6 +596,9 @@ void main() {
|
||||
testWidgets('should_seek_and_open_player_from_feed_actions', (tester) async {
|
||||
var opened = 0;
|
||||
Duration? seeked;
|
||||
final scrubVisibility = <bool>[];
|
||||
final thumbnailService = _nullThumbnailService();
|
||||
addTearDown(thumbnailService.dispose);
|
||||
final controller = ValueNotifier<VideoPlayerValue>(
|
||||
VideoPlayerValue(
|
||||
duration: const Duration(seconds: 100),
|
||||
@@ -616,7 +648,9 @@ void main() {
|
||||
onOpenFullPlayer: () => opened++,
|
||||
onMore: () {},
|
||||
onScrubStart: () {},
|
||||
onScrubVisibilityChanged: scrubVisibility.add,
|
||||
onSeek: (value) => seeked = value,
|
||||
thumbnailService: thumbnailService,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -647,7 +681,7 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress'))).height,
|
||||
12,
|
||||
greaterThanOrEqualTo(24),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
@@ -668,6 +702,10 @@ void main() {
|
||||
);
|
||||
await gesture.moveBy(const Offset(120, 0));
|
||||
await tester.pump();
|
||||
expect(scrubVisibility.last, isTrue);
|
||||
expect(find.byKey(const Key('home-feed-title')), findsNothing);
|
||||
expect(find.byKey(const Key('rail-save')), findsNothing);
|
||||
expect(find.byType(ScrubPreviewCard), findsOneWidget);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(14, 14),
|
||||
@@ -691,6 +729,8 @@ void main() {
|
||||
);
|
||||
await gesture.up();
|
||||
await tester.pumpAndSettle();
|
||||
expect(scrubVisibility.last, isFalse);
|
||||
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
|
||||
expect(seeked, isNotNull);
|
||||
expect(seeked!.inSeconds, greaterThan(0));
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user