-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Dropdown callbacks WIP #56202
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
Dropdown callbacks WIP #56202
Conversation
|
I saw two Golden test failures and am unsure how to proceed. Can someone offer guidance? |
|
Hixie is be available through github pings, but you can find him on discord. |
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.
I'm wondering if the better API would be onCanceled that is only triggered when the menu is closed without selecting any item. If we have onCanceled then it's easy to combine them into an onClosed, but it's not easy to separate an onCanceled out of onClosed.
| this.disabledHint, | ||
| @required this.onChanged, | ||
| this.onTap, | ||
| this.onClosed, |
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.
Can you remove the onClosed to just after the onChanged? (As well as other occurrances)
| /// The callback will not be invoked if the dropdown button is disabled. | ||
| final VoidCallback onTap; | ||
|
|
||
| ///Called when the dropdown is closed, regardless of if a selection was made. |
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.
This and all the docs
| ///Called when the dropdown is closed, regardless of if a selection was made. | |
| /// Called when the dropdown is closed, regardless of if a selection was made. |
Also please take a look at dartdoc specific requirements. Mostly about the first paragraph, and we'll probably want onClosed and onChanged to refer to each other as "See also".
| widget.onChanged(value); | ||
| } | ||
| } | ||
| } |
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.
Add an empty line at the end of the file (as well as other files)
|
Hi. Can you update this PR as the review comments? Most of them are trivial, and once they're fixed we can get this PR merged :) |
|
We'll close this PR for now. Feel free to re-open in case you're interested in addressing the comments and finishing the PR! |
Add an onClosed callback for dropdownButtons. This callback is fired whether a new selection is made or not, it is fired after onChanged when a new selection has been made.
Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR. There should be at least one issue listed here.
Tests
I added the following tests:
"DropdownButton onClosed callback is called when defined" in flutter/test/material/dropdown_test.dart
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.