Add missing `primary` to home screen list views (#779)
* Add missing `primary` to home screen list views
* add test
diff --git a/lib/pages/home.dart b/lib/pages/home.dart
index cba09d7..bab6825 100644
--- a/lib/pages/home.dart
+++ b/lib/pages/home.dart
@@ -168,6 +168,7 @@
body: ListView(
// Makes integration tests possible.
key: const ValueKey('HomeListView'),
+ primary: true,
padding: const EdgeInsetsDirectional.only(
top: firstHeaderDesktopTopPadding,
),
@@ -383,6 +384,7 @@
ListView(
// Makes integration tests possible.
key: const ValueKey('HomeListView'),
+ primary: true,
restorationId: 'home_list_view',
children: [
const SizedBox(height: 8),
diff --git a/test/pages/home_test.dart b/test/pages/home_test.dart
index efb84d5..5fb6ac4 100644
--- a/test/pages/home_test.dart
+++ b/test/pages/home_test.dart
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gallery/main.dart';
@@ -22,4 +23,14 @@
expect(find.bySemanticsLabel('Settings'), findsNothing);
expect(find.bySemanticsLabel('Close settings'), findsOneWidget);
});
+
+ testWidgets('Home page list view is the primary list view', (tester) async {
+ await tester.pumpWidget(const GalleryApp());
+ await tester.pumpAndSettle();
+
+ ListView listview =
+ tester.widget(find.byKey(const ValueKey('HomeListView')));
+
+ expect(listview.primary, true);
+ });
}
diff --git a/test/widget_test.dart b/test/widget_test.dart
deleted file mode 100644
index 5a87de6..0000000
--- a/test/widget_test.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2019 The Flutter team. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-void main() {}