Add detection of drawer open and close in Scaffold widget as a callback method.#67249
Conversation
Sync forked repo with original repo
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
5423b45 to
ec46e40
Compare
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
|
Hi @bikcrum and we need a test as well. |
Sync with base master
Sync with master
@chunhtai Thank you for suggesting what went wrong. I have made a few changes to the file and now it has passed all the tests. |
|
@bikcrum Hi, we need a test in order to merge this PR |
Yes, of course. If there is anything that is to be done from my side, please do let me know. Thank you. |
|
You can write a test similar to this one in the same file The goal is to verify the callback is called when drawer opens or closes |
486b61d to
2856cbe
Compare
I have added a test to the file. As per the automatic checks, I am not sure why 'Mac framework_tests' is failing. Can you provide me any suggestions? |
c23b8c1 to
2856cbe
Compare
Sync with master
Sync with master
Thank you for approving the PR. So, are we waiting for |
|
I was going to put the "waiting for tree to go green" label on (which automatically lands the patch when flutter-build goes green) but actually can we make a slight change first? For consistency with our style guide, the properties should be called "on Event", as in |
Thank you for your suggestion. I have renamed the parameters accordingly. |
|
When will this change make it into the stable channel? |
It is released now in Flutter version 2.0.0 |
Description
The change contains the addition of drawer callbacks in
Scaffoldwidget. These are useful for the detection of the drawer open or closed, implemented in Scaffold. This accounts for bothdrawerandendDrawerhaving their callbacks namelydrawerCallbackandendDrawerCallbackrespectively inScaffoldconstructor properly. There might be multiple reason when we want to change the state of the widget according to the state of the drawer, open or closed. It is always better to have a simple callback inScaffoldrather than letting users explicitly write a bunch of code to handle this.Implementation: drawerCallback and endDrawerCallback are added property in the constructor which provides with the state of the drawer whether opened or closed.
Related Issues
#43512
#14510
Tests
I added the following tests:
I have used the above snippet to test the callback implementation. The following test applies for both
drawerandendDrawerChecklist
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.