feat(flutter): 压缩首页剧卡并把播放次数上封面

This commit is contained in:
Zhou Weidong committed 2026-10-20 13:03:19 +08:00
1 parent 8e2cd5c838
commit 124ba75ab8
3 files changed
+104 -58

No files matched your search

+20 -1
View File
@@ -3,6 +3,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/app.dart';
import 'package:fruitshorts/core/data/models/drama.dart';
import 'package:fruitshorts/core/data/models/home_feed.dart';
import 'package:fruitshorts/core/data/models/watch_progress.dart';
import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
@@ -104,7 +105,23 @@ void main() {
});
testWidgets('should_pin_home_channels_when_scrolling', (tester) async {
await _pumpApp(tester);
// 多放几部剧,保证内容高度足够滚过吸顶阈值。
await _pumpApp(
tester,
withBanner: false,
dramas: [
for (var index = 0; index < 10; index++)
Drama(
id: 'scroll-$index',
title: 'Scroll Drama $index',
synopsis: 'synopsis',
posterUrl: '/files/scroll-$index.png',
genre: 'Drama',
totalEpisodes: 10,
freeEpisodes: 10,
),
],
);
final before = tester.getRect(find.byKey(const Key('home-channel-hot')));
expect(find.byKey(const Key('home-channels-pinned')), findsNothing);
@@ -278,12 +295,14 @@ Future<void> _pumpApp(
WatchHistoryRepository? history,
Size size = const Size(390, 844),
bool withBanner = true,
List<Drama>? dramas,
}) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final catalog = FakeCatalogRepository(
dramas: dramas,
banners: withBanner
? const [
FeedBanner(