feat(flutter): 首页网格改为三列并首位显示全部

This commit is contained in:
Zhou Weidong committed 2026-10-17 22:34:14 +08:00
1 parent 0466b4b425
commit f0db631fa2
4 files changed
+17 -11

No files matched your search

+11 -5
View File
@@ -25,7 +25,7 @@ void main() {
});
testWidgets(
'should_show_all_dramas_in_two_column_sliver_grid_without_continue_watching',
'should_show_all_dramas_in_three_column_sliver_grid_without_continue_watching',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
@@ -38,15 +38,21 @@ void main() {
expect(find.text('Continue Watching'), findsNothing);
expect(find.text('All Dramas'), findsOneWidget);
expect(find.text('All'), findsOneWidget);
expect(find.text('For You'), findsNothing);
expect(
tester.getCenter(find.text('All')).dx,
lessThan(tester.getCenter(find.text('Hot')).dx),
);
final grid = tester.widget<SliverGrid>(
find.byKey(const Key('home-all-dramas-grid')),
);
final delegate =
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
expect(delegate.crossAxisCount, 2);
expect(delegate.crossAxisSpacing, 12);
expect(delegate.mainAxisSpacing, 16);
expect(delegate.crossAxisCount, 3);
expect(delegate.crossAxisSpacing, 10);
expect(delegate.mainAxisSpacing, 14);
expect(delegate.childAspectRatio, closeTo(2 / 3, 0.001));
expect(
tester
@@ -154,7 +160,7 @@ void main() {
expect(find.byKey(const Key('home-all-dramas-grid')), findsNothing);
});
testWidgets('should_fit_two_column_grid_on_compact_screen', (tester) async {
testWidgets('should_fit_three_column_grid_on_compact_screen', (tester) async {
tester.view.physicalSize = const Size(320, 568);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);