Skip to content

Conversation

@Benqstanley
Copy link

@Benqstanley Benqstanley commented May 2, 2020

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@Benqstanley
Copy link
Author

I saw two Golden test failures and am unsure how to proceed. Can someone offer guidance?

@Hixie

@Benqstanley Benqstanley changed the title Dropdown callbacks Dropdown callbacks WIP May 2, 2020
@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 8, 2020
@dkwingsmt
Copy link
Contributor

Hixie is be available through github pings, but you can find him on discord.
In the meantime, I don't see any golden failures anymore.

@HansMuller HansMuller requested a review from dkwingsmt May 8, 2020 22:44
Copy link
Contributor

@dkwingsmt dkwingsmt left a 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,
Copy link
Contributor

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.
Copy link
Contributor

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

Suggested change
///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);
}
}
}
Copy link
Contributor

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)

@dkwingsmt
Copy link
Contributor

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 :)

@dkwingsmt
Copy link
Contributor

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!

@dkwingsmt dkwingsmt closed this Jun 8, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

4 participants