fix(flutter): 精修首页 feed 交互与底色
This commit is contained in:
1 parent
435fbbbbb1
commit
321c62664c
17 files changed
+427
-448
No files matched your search
@@ -14,6 +14,7 @@ import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart
|
||||
import 'package:fruitshorts/core/theme/app_theme.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/home_feed_overlay.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import '../support/fake_catalog.dart';
|
||||
import '../support/fake_category.dart';
|
||||
@@ -112,7 +113,8 @@ void main() {
|
||||
onShare: () {},
|
||||
onEpisodes: () {},
|
||||
onDetail: () {},
|
||||
onFullscreen: () {},
|
||||
onOpenFullPlayer: () {},
|
||||
onRefreshFeed: () {},
|
||||
onDownload: () {},
|
||||
onClear: () {},
|
||||
onSearch: () {},
|
||||
@@ -145,4 +147,82 @@ void main() {
|
||||
'12',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('should_refresh_seek_and_open_player_from_feed_actions', (
|
||||
tester,
|
||||
) async {
|
||||
var refreshed = 0;
|
||||
var opened = 0;
|
||||
Duration? seeked;
|
||||
final controller = ValueNotifier<VideoPlayerValue>(
|
||||
VideoPlayerValue(
|
||||
duration: const Duration(seconds: 100),
|
||||
position: const Duration(seconds: 10),
|
||||
isInitialized: true,
|
||||
),
|
||||
);
|
||||
addTearDown(controller.dispose);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
locale: const Locale('en'),
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
home: Builder(
|
||||
builder: (context) => Scaffold(
|
||||
body: HomeFeedOverlay(
|
||||
l10n: AppLocalizations.of(context)!,
|
||||
drama: const Drama(
|
||||
id: 'action-drama',
|
||||
title: 'Action Drama',
|
||||
synopsis: 'synopsis',
|
||||
posterUrl: '',
|
||||
totalEpisodes: 8,
|
||||
viewCount: 1200,
|
||||
),
|
||||
episode: const Episode(
|
||||
id: 'action-episode',
|
||||
number: 1,
|
||||
title: 'Episode 1',
|
||||
isFree: true,
|
||||
),
|
||||
controller: controller,
|
||||
liked: false,
|
||||
saved: false,
|
||||
onLike: () {},
|
||||
onSave: () {},
|
||||
onComments: () {},
|
||||
onShare: () {},
|
||||
onEpisodes: () {},
|
||||
onDetail: () {},
|
||||
onOpenFullPlayer: () => opened++,
|
||||
onRefreshFeed: () => refreshed++,
|
||||
onDownload: () {},
|
||||
onClear: () {},
|
||||
onSearch: () {},
|
||||
onScrubStart: () {},
|
||||
onSeek: (value) => seeked = value,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-refresh')));
|
||||
await tester.pump();
|
||||
expect(refreshed, 1);
|
||||
|
||||
await tester.drag(
|
||||
find.byKey(const Key('home-feed-progress')),
|
||||
const Offset(120, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(seeked, isNotNull);
|
||||
expect(seeked!.inSeconds, greaterThan(0));
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-full-series')));
|
||||
await tester.pump();
|
||||
expect(opened, 1);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user