-
Notifications
You must be signed in to change notification settings - Fork 28.5k
ExpansionPanel isExpanded callback parameter (Ticket 74114) #128082
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
Conversation
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.
Thanks for the contribution!
_currentOpenPanel = isExpanded ? null : pressedChild; | ||
}); | ||
} | ||
else | ||
{ | ||
widget.expansionCallback?.call(index, !isExpanded); |
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.
Since it looks like this is called either way (in the if or else block), can the else block be removed and it just be called unconditionally after the if statement?
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.
Yes, that was an oversight. I refactored and all tests are still passing.
@@ -144,7 +144,7 @@ void main() { | |||
expect(find.byType(ExpandIcon), findsOneWidget); | |||
await tester.tap(find.byType(ExpandIcon)); | |||
expect(capturedIndex, 0); | |||
expect(capturedIsExpanded, isFalse); | |||
expect(capturedIsExpanded, isTrue); |
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.
Since this issue has existed for a while, developers may be broken by this. I am going to run some extra tests internally to see if it breaks anyone.
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.
Ok, sounds good, thanks again for the help.
@Piinks I addressed your feedback, thanks again! |
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.
@Piinks sounds good, thanks for checking. |
All set, thanks for your patience! |
auto label is removed for flutter/flutter, pr: 128082, due to This PR has not met approval requirements for merging. You are not a member of flutter-hackers and need 1 more review(s) in order to merge this PR.
|
Ah we need one more approval. On it! |
I left a link to the PR in the Discord channel to see if anyone could review. |
Hmm.. likewise. Let me see if I can motivate. :) |
sounds good. :) just figured I would put a request out there. |
Oh of course! You are more than welcome too, I just feel bad no one came around yet. We'll see about getting this checked out. |
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.
LGTM, just some formatting nits. Thanks for the PR!
@justinmc thanks for the review. I made the changes you asked for. |
This reverts commit 443bdb7.
flutter/flutter@da127f1...3df163f 2023-06-11 [email protected] Roll Flutter Engine from 73a7af805472 to 1cca9cc6dbd1 (1 revision) (flutter/flutter#128658) 2023-06-11 [email protected] Roll Flutter Engine from 7c6770083e5c to 73a7af805472 (2 revisions) (flutter/flutter#128654) 2023-06-11 [email protected] Roll Flutter Engine from 6d615bbcfccf to 7c6770083e5c (2 revisions) (flutter/flutter#128653) 2023-06-11 [email protected] Roll Flutter Engine from b19b93de5b0a to 6d615bbcfccf (1 revision) (flutter/flutter#128650) 2023-06-11 [email protected] Roll Flutter Engine from 3d76ba6d6d5f to b19b93de5b0a (2 revisions) (flutter/flutter#128649) 2023-06-11 [email protected] Roll Flutter Engine from 962d78e0ae9c to 3d76ba6d6d5f (1 revision) (flutter/flutter#128645) 2023-06-10 [email protected] migrate `Tooltip` to use `OverlayPortal` (flutter/flutter#127728) 2023-06-10 [email protected] Roll Flutter Engine from b037db26037f to 962d78e0ae9c (10 revisions) (flutter/flutter#128643) 2023-06-10 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.2 to 3.5.3 (flutter/flutter#128625) 2023-06-10 [email protected] Roll Flutter Engine from 3e90345cdca7 to b037db26037f (1 revision) (flutter/flutter#128627) 2023-06-10 [email protected] Remove unnecessary parentheses (flutter/flutter#128620) 2023-06-09 [email protected] Roll Flutter Engine from 488876ed26c6 to 3e90345cdca7 (3 revisions) (flutter/flutter#128617) 2023-06-09 [email protected] rename generated asset manifest file back to `AssetManifest.bin` (from `AssetManifest.smcbin`) (flutter/flutter#128529) 2023-06-09 [email protected] Add Selected semantics to IconButton (flutter/flutter#128547) 2023-06-09 [email protected] Roll Flutter Engine from 071e1fb21c7a to 488876ed26c6 (5 revisions) (flutter/flutter#128612) 2023-06-09 [email protected] Clarifies semantics long press and semantics on tap documentation (flutter/flutter#128599) 2023-06-09 [email protected] Roll Flutter Engine from bc6e047570f6 to 071e1fb21c7a (1 revision) (flutter/flutter#128602) 2023-06-09 [email protected] Revert "Update `chip.dart` to use set of `MaterialState`" (flutter/flutter#128607) 2023-06-09 [email protected] Add tooltips for `SegmentedButton` (flutter/flutter#128501) 2023-06-09 [email protected] Ignore app.stop events received before the app.detach response in attach integration tests (flutter/flutter#128593) 2023-06-09 [email protected] ExpansionPanel isExpanded callback parameter (Ticket 74114) (flutter/flutter#128082) 2023-06-09 [email protected] Roll Flutter Engine from 93afba901b3b to bc6e047570f6 (3 revisions) (flutter/flutter#128594) 2023-06-09 [email protected] Updated flutter_localizations tests for Material3; (flutter/flutter#128521) 2023-06-09 [email protected] Paint SelectableFragments before text (flutter/flutter#128375) 2023-06-09 [email protected] Roll Packages from e13b8c4 to afe2f05 (7 revisions) (flutter/flutter#128582) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
After upgrading to Flutter 3.13 today, I encountered an bug due to this PR. I had very hard time debugging the issue. |
@your-diary Only changes that break tests are officially considered to be breaking changes, see this section of the wiki. That said, we don't want to change any behavior for users of ExpansionPanel. Can you file a new issue and link it here? @dleyba042 Any idea what we can do here? |
I was running final tests on an app when I suddenly noticed that the tabs weren't opening anymore. I was sure I hadn't touched the script and it was unfortunate after hours of questioning and debugging to find that the bool had been flipped. I'm a little concerned that in the future, out of nowhere, a bool that was fine up until then could be flipped, ending up breaking my code without me noticing. I don't know the flutter update processes in detail, but I'll try to give an advice even if it's too late: maybe instead of inverting the bool you could change the variable name? In order to force the developer to notice the change. (translated) |
This PR also breaks the flutter documentation, which must be adapted. See here for example: https://api.flutter.dev/flutter/material/ExpansionPanelList-class.html |
@your-diary I saw your #133025 and that it was dismissed and closed. Thanks for your effort to improve the process. |
Fixes #74114
This PR addresses the issue detailed here: #74114 . The boolean isExpanded returned by the expansion panel callback now reflects the state of the panel that the user is seeing. If it's expanded on screen then the callback returns true. When you close the panel the callback returns false. When another panel is open and you open a different one, the callback executes twice. It returns isExpanded == false for the panel you are closing and true for the panel that is being opened.
I had to change the code in a couple existing tests because some tests are using the old behavior of the callback. This PR addresses feedback listed in closed PR -> #127876 . The reasone the original PR is closed is that I was having some struggles with git. A couple of the commits in this PR are just reverts of commits I meant not to happen.
Pre-launch Checklist
If you need help, consider asking for advice on the #hackers-new channel on Discord.