@@ -4058,6 +4058,47 @@ void main() {
40584058 await tester.pump ();
40594059 expect (searchViewState, 'Closed' );
40604060 });
4061+
4062+ testWidgets (
4063+ 'The last element of the suggestion list should be visible when scrolling to the end of list' ,
4064+ (WidgetTester tester) async {
4065+ await tester.pumpWidget (
4066+ MaterialApp (
4067+ home: SearchAnchor .bar (
4068+ suggestionsBuilder: (BuildContext context, SearchController controller) {
4069+ return List <Widget >.generate (30 , (int index) {
4070+ return ListTile (
4071+ titleAlignment: ListTileTitleAlignment .center,
4072+ title: Text ('Item $index ' ),
4073+ );
4074+ });
4075+ },
4076+ ),
4077+ ),
4078+ );
4079+
4080+ // Open search view.
4081+ await tester.tap (find.byIcon (Icons .search));
4082+ await tester.pumpAndSettle ();
4083+ const double fakeKeyboardHeight = 500.0 ;
4084+ final double physicalBottomPadding = fakeKeyboardHeight * tester.view.devicePixelRatio;
4085+
4086+ // Simulate the keyboard opening resizing the view.
4087+ tester.view.viewInsets = FakeViewPadding (bottom: physicalBottomPadding);
4088+ addTearDown (tester.view.reset);
4089+
4090+ // Scroll down to the end of the list.
4091+ expect (find.byType (ListView ), findsOne);
4092+ await tester.fling (find.byType (ListView ), const Offset (0 , - 5000 ), 5000 );
4093+ await tester.pumpAndSettle ();
4094+
4095+ // The last item should not be hidden by the keyboard.
4096+ final double lastItemBottom = tester.getRect (find.text ('Item 29' )).bottom;
4097+ final double fakeKeyboardTop =
4098+ tester.getSize (find.byType (MaterialApp )).height - fakeKeyboardHeight;
4099+ expect (lastItemBottom, lessThanOrEqualTo (fakeKeyboardTop));
4100+ },
4101+ );
40614102}
40624103
40634104Future <void > checkSearchBarDefaults (
0 commit comments