Repository navigation
[material_ui] Document how to programmatically clear DropdownMenu selection - #13266
dkbharti-glitch wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds a new code sample and widget tests demonstrating how to programmatically clear or reset the selection in a DropdownMenu using a TextEditingController. It also updates the documentation for DropdownMenu, its controller property, and its initialSelection property to explain this behavior and reference the new example. A pending changelog entry is also included. There are no review comments, and I have no feedback to provide.
65f4940 to
ea69ee2
Compare
…ection Improve documentation and add an interactive sample demonstrating how to programmatically clear or reset the selection in DropdownMenu using a TextEditingController alongside resetting the state variable. Fixes flutter/flutter#177599
ea69ee2 to
90aa5d2
Compare
Description
Clarifies how to programmatically clear or reset the selection in
DropdownMenu.Setting
initialSelectionto null does not clear the text field because it only sets the initial value. This PR documents that providing aTextEditingControllerand callingcontroller.clear()alongside updating the state variable to null is required to reset the selection, and adds an interactive code sample demonstrating this pattern.Fixes flutter/flutter#177599
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2