File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -807,6 +807,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
807807 } else {
808808 filteredEntries = widget.dropdownMenuEntries;
809809 }
810+ _menuHasEnabledItem = filteredEntries.any ((DropdownMenuEntry <T > entry) => entry.enabled);
810811
811812 if (_enableSearch) {
812813 if (widget.searchCallback != null ) {
Original file line number Diff line number Diff line change @@ -1315,6 +1315,28 @@ void main() {
13151315 expect (tester.takeException (), isNull);
13161316 });
13171317
1318+ // Regression test for https://github.com/flutter/flutter/issues/154532.
1319+ testWidgets ('Searching for non matching item does not crash' , (WidgetTester tester) async {
1320+ await tester.pumpWidget (MaterialApp (
1321+ home: Scaffold (
1322+ body: DropdownMenu <TestMenu >(
1323+ enableFilter: true ,
1324+ requestFocusOnTap: true ,
1325+ dropdownMenuEntries: menuChildren,
1326+ ),
1327+ ),
1328+ ));
1329+
1330+ // Open the menu.
1331+ await tester.tap (find.byType (DropdownMenu <TestMenu >));
1332+ await tester.pump ();
1333+ await tester.enterText (find.byType (TextField ).first, 'Me' );
1334+ await tester.pumpAndSettle ();
1335+ await tester.enterText (find.byType (TextField ).first, 'Meu' );
1336+ await tester.pumpAndSettle ();
1337+ expect (tester.takeException (), isNull);
1338+ });
1339+
13181340 // Regression test for https://github.com/flutter/flutter/issues/147253.
13191341 testWidgets ('Default search prioritises the current highlight on desktop platforms' ,
13201342 (WidgetTester tester) async {
You can’t perform that action at this time.
0 commit comments