-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Revert rematching DropdownMenu.initialSelection #160643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert rematching DropdownMenu.initialSelection #160643
Conversation
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who would have thought that the single request from #155660 would result in 3 PRs in total?
Thanks for all the work you've put into this!
|
When will this change be live you think? My usecase is indeed as others have mentioned an address search, where alternatives are updated as the user types into the search field. |
|
@andreasmpet thanks for sharing your experience. We might be able to get this cherry-picked into 3.27.2 within the next few weeks. Edit: cherry-pick pull request was merged! This fix should indeed show up in 3.27.2. |
This comment was marked as resolved.
This comment was marked as resolved.
…n when entries have changed" (#161177) This pull request reverts the changes in #155757. The auto-formatter created conflicts in the master branch, so the revert was performed manually in #160643. For this cherry-pick PR, I was able to run `git revert 21381d8` without any problems. <br> ### Issue Links bug reports: #160196, #160555 cherry-pick request: #161176 ### Target stable ### Changelog Description Passing a list literal to a `DropdownMenu` causes the widget to reset to the `initialSelection` after each build. ### Impacted Users This affects anyone using the [DropdownMenu](https://api.flutter.dev/flutter/material/DropdownMenu-class.html) widget. ### Impact Description The impact usually consists of the text value being inconveniently reset each time the widget is rebuilt. (In some cases it can be a fatal crash: the code sample from #160196 shows how this change can lead to an infinite build loop.) ### Workaround This regression can be mitigated by caching & modifying a single list instance, rather than using a list literal for the `DropdownMenu` constructor. ### Risk low ### Test Coverage yes ### Validation Steps #160643 added a regression test for this revert. The fix can also be verified by running the code sample from #160196 and verifying that there is no infinite build loop.
|
Superb that this fix is fast-tracked. When is the estimated release for 3.27.2? Thanks! |
|
@andreasmpet I unfortunately don't know the answer, since it is up to the release team and is not public information. My best guess would be that it's |
Description
This PR reverts
DropdownMenuchanges from #155757.Automatically rematching the
initialSelectionbreaks some use cases.It is more flexible to let users manipulate the text field content using the TextEditingController.
Related Issue
Fixes Dropdown Menu Creates Infinite Build Loop
Fixes Can no longer initialize non selectable value in DropdownMenu as of flutter version 3.27.1
Tests
Removes 2 regression tests from #155757.
Keeps 2 tests from the original PR (missing test for the initialSelection behavior).
Adds 1 tests to avoid regressing this revert.