feat(flutter): 首页频道行滚动吸顶
This commit is contained in:
1 parent
cfc41efddc
commit
7cc65b7b09
2 files changed
+104
-44
No files matched your search
@@ -90,16 +90,33 @@ void main() {
|
||||
);
|
||||
expect(card.borderRadius, BorderRadius.zero);
|
||||
|
||||
// 频道行在 hero Stack 内、位于轮播顶部 8 的位置上。
|
||||
// 频道行是固定层,不在可滚动列表里,初始仍压在轮播顶部。
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: find.byKey(const Key('home-channels')),
|
||||
matching: find.byKey(const Key('home-hero-section')),
|
||||
matching: find.byKey(const Key('home-browse-page')),
|
||||
),
|
||||
findsOneWidget,
|
||||
findsNothing,
|
||||
);
|
||||
final channels = tester.getRect(find.byKey(const Key('home-channels')));
|
||||
expect(channels.top, closeTo(hero.top + 8, 1));
|
||||
expect(channels.top, closeTo(hero.top, 1));
|
||||
expect(find.byKey(const Key('home-channels-pinned')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_pin_home_channels_when_scrolling', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
final before = tester.getRect(find.byKey(const Key('home-channel-hot')));
|
||||
expect(find.byKey(const Key('home-channels-pinned')), findsNothing);
|
||||
|
||||
await tester.drag(
|
||||
find.byKey(const Key('home-browse-page')),
|
||||
const Offset(0, -300),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-channels-pinned')), findsOneWidget);
|
||||
final after = tester.getRect(find.byKey(const Key('home-channel-hot')));
|
||||
expect(after.top, closeTo(before.top, 0.5));
|
||||
});
|
||||
|
||||
testWidgets('should_open_theater_search_when_home_search_is_tapped', (
|
||||
|
||||
Reference in new issue
Block a user