fix(flutter): 修复剧场吸顶分类行闪烁并压缩间距
This commit is contained in:
1 parent
963f376159
commit
d1abfd47c7
2 files changed
+72
-25
No files matched your search
@@ -226,6 +226,46 @@ void main() {
|
||||
expect(header().color, AppColors.ink);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_category_row_stable_across_scrolls', (tester) async {
|
||||
await _pumpTheater(
|
||||
tester,
|
||||
categoryRepository: _GridCategoryRepository(
|
||||
discoverFeed: _tallDiscoverFeed,
|
||||
),
|
||||
);
|
||||
double categoryTop() =>
|
||||
tester.getRect(find.byKey(const Key('theater-category-chips'))).top;
|
||||
final initial = categoryTop();
|
||||
|
||||
await tester.drag(_verticalFeed, const Offset(0, -120));
|
||||
await tester.pumpAndSettle();
|
||||
final once = categoryTop();
|
||||
await tester.drag(_verticalFeed, const Offset(0, -120));
|
||||
await tester.pumpAndSettle();
|
||||
final twice = categoryTop();
|
||||
await tester.drag(_verticalFeed, const Offset(0, 400));
|
||||
await tester.pumpAndSettle();
|
||||
final backToTop = categoryTop();
|
||||
|
||||
expect(once, closeTo(initial, 0.5));
|
||||
expect(twice, closeTo(initial, 0.5));
|
||||
expect(backToTop, closeTo(initial, 0.5));
|
||||
});
|
||||
|
||||
testWidgets('should_keep_small_gap_between_category_and_toolbar', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpTheater(tester, categoryRepository: _GridCategoryRepository());
|
||||
final categoryBottom = tester
|
||||
.getRect(find.byKey(const Key('theater-category-chips')))
|
||||
.bottom;
|
||||
final toolbarTop = tester
|
||||
.getRect(find.byKey(const Key('theater-toolbar-filter')))
|
||||
.top;
|
||||
|
||||
expect(toolbarTop - categoryBottom, inInclusiveRange(0, 6));
|
||||
});
|
||||
|
||||
testWidgets('should_show_category_underline_for_selection', (tester) async {
|
||||
await _pumpTheater(tester, categoryRepository: _GridCategoryRepository());
|
||||
Color underline(String id) =>
|
||||
|
||||
Reference in new issue
Block a user