Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Sep 1, 2025

Description

This PR fixes DropdownMenu filtering.
The implementation choice is to not rely on storing the selected index and to store the selected value instead.

Related Issue

Fixes DropdownMenu filtering is broken

Tests

Adds 1 test.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Sep 1, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves a filtering issue in the DropdownMenu widget by changing the state management from tracking the selected index to tracking the selected value. This is a robust solution that correctly decouples the selection state from the dynamic list of menu entries, preventing errors when the list is filtered or updated. The implementation is clean, and the addition of a new regression test ensures the fix is well-covered. The changes look good and address the problem described.

@bleroux bleroux force-pushed the fix_dropdownmenu_filtering_is_broken branch from 710727a to 2d21995 Compare September 1, 2025 06:43
@bleroux
Copy link
Contributor Author

bleroux commented Sep 1, 2025

Closing in favor of #174757.

@bleroux bleroux closed this Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DropdownMenu filtering is broken (after selecting an item, it reverts to a different value)

1 participant