-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Added computeDryBaseline implementation in RenderAligningShiftedBox #171250
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
Added computeDryBaseline implementation in RenderAligningShiftedBox #171250
Conversation
Implements computeDryBaseline method in RenderShiftedBox to fix layout failures when DropdownButtonFormField is used inside Wrap inside AlertDialog. The method calculates baseline using dry layout methods and accounts for child positioning within the parent's coordinate space. Fixes flutter/issues/169214
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
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. |
|
Thanks for opening a PR for this! Would you be able to add a test? Ideally something that reproduces the issue in #169214 and shows that it no longer happens with this change. |
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@justinmc while creating tests i came across that "RenderSizedBox" has not implemented method "computeDryBaseline" either, but i don't have a deep flutter framework understanding so i don't know if this is a bug |
…teDryBaseline in RenderShiftedBox
…est/app_test.dart to check if issue 169214 still occurs
|
@justinmc how can i add a checksum in my pubspec.yaml, that is needed for my integration test. Which algorithm/command is used? (most of the tests in CI/CD are failing because the checksum does not exist) locally integration test reproduces the flutter error flutter/flutter/issues/169214 and ensures its working |
…igningShiftedBox for issue 169214
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.
Maybe you don't need an integration test at all?
I'm still curious about the checksum though. I actually don't know how those are generated off the top of my head. I'll look for an answer either way.
Edit: I believe you need to run flutter update-packages --update-hashes to update that checksum. Thanks to @jason-simmons for helping me out with that.
dev/integration_tests/alert_dialog_dropdown_crash/integration_test/app_test.dart
Outdated
Show resolved
Hide resolved
…eate # PUBSPEC CHECKSUM: (yes it does)
…st/material/dropdown_dialog_baseline_test.dart and update computeDryBaseline in RenderAligningShiftedBox to prevent crashes with DropdownButton in AlertDialog
|
@justinmc I added missing computeDryBaseline in RenderAlignedShiftedBox also now a unittest exists: packages/flutter/test/rendering/shifted_box_test.dart and I replaced the integration test with a much less ressource intensive widget test: packages/flutter/test/rendering/aligning_shifted_box_baseline_test.dart to verify computeDryBaseline in RenderAlignedShiftedBox exists, and the widget test reproduces the issue in #169214 |
… to aligning_shifted_box_baseline_test.dart
…puteDryBaseline tests
…eline Resolved merge conflicts in packages/flutter/lib/src/semantics/binding.dart Removed semantics_binding_set_semantics_tree_enabled_test.dart (deleted upstream)
|
To provide some context, I originally wanted to fix an issue that appeared when a DropdownButtonFormField was used inside a Wrap inside an AlertDialog, as described in #169214. The issue was that the implementation of the 'computeDryBaseline' function was missing in the 'RenderAligningShiftedBox' class. I added this, as well as unit and widget tests. Quite a few tests were failing, so I had to edit some files. For example, the renderAnimatedSize also had no computeDryBaseline implementation, as did RenderShiftedBox, RenderPositionedBox and _RenderBadge. In material/button.dart, material/button_style_button.dart and _RenderInputPadding, the Size(width, height) was mixed up. |
justinmc
left a comment
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 as long as Google tests pass. Thank you for all of the work and iterations on this. The lack of (or incorrect) dry layout calculations were probably causing headaches for a lot of users.
| final double height = math.max(childSize.width, minSize.width); | ||
| final double width = math.max(childSize.height, minSize.height); | ||
| return constraints.constrain(Size(height, width)); | ||
| final double width = math.max(childSize.width, minSize.width); | ||
| final double height = math.max(childSize.height, minSize.height); | ||
| return constraints.constrain(Size(width, height)); |
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.
Good catch!
| if (result == null) { | ||
| return null; | ||
| } | ||
| // Calculate the size and child offset using the same logic as performLayout |
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.
Nit: Period at the end of this comment and a few other comments below.
| double pos = leadingSpace; | ||
| for (RenderBox? child = startChild; child != null; child = nextChildPaintOrder(child)) { | ||
| mainPositions[child] = pos; | ||
| final BoxConstraints cc = constraintsForChild(child); | ||
| final Size cs = child.getDryLayout(cc); | ||
| pos += _getMainSize(cs) + betweenSpace; |
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.
Avoid abbreviations per the styleguide, here and at least one more time below.
| TextBaseline.alphabetic, | ||
| ); | ||
|
|
||
| expect(baseline, isNotNull); |
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.
What caused you to expect isNotNull here instead of the specific value?
|
Friendly ping @chunhtai Are you still comfortable reviewing this PR or would you like someone else to take over it? (from triage) |
chunhtai
left a comment
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 once justin's comments are addressed
|
autosubmit label was removed for flutter/flutter/171250, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
…lutter#171250) <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Implements computeDryBaseline method in RenderAligningShiftedBox to fix layout failures when DropdownButtonFormField is used inside Wrap inside AlertDialog. The method calculates baseline using dry layout methods and accounts for child positioning within the parent's coordinate space. Issue appeared when DropdownButtonFormField was used inside a Wrap inside Alertdialog Fixes [flutter/issues/169214](flutter#169214) ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Tong Mu <[email protected]>
flutter/flutter@df72035...6f8abdd 2025-10-30 [email protected] Roll Skia from 5035cdc7de31 to 18457971c30f (1 revision) (flutter/flutter#177767) 2025-10-30 [email protected] Roll Skia from 018e2cdba2fe to 5035cdc7de31 (3 revisions) (flutter/flutter#177764) 2025-10-30 [email protected] Roll Dart SDK from a0480f399f8f to 4785d5971d64 (21 revisions) (flutter/flutter#177760) 2025-10-30 [email protected] Roll Skia from c803f12d2e26 to 018e2cdba2fe (1 revision) (flutter/flutter#177759) 2025-10-30 [email protected] Roll Skia from 51267d4a2cea to c803f12d2e26 (2 revisions) (flutter/flutter#177756) 2025-10-30 [email protected] Roll Fuchsia Linux SDK from 3EF6k6lqXPWDwrdyj... to ksXeDDo2yYBXJ4uEu... (flutter/flutter#177754) 2025-10-30 [email protected] impeller: allow setting image sampler uniforms by name (flutter/flutter#176749) 2025-10-30 [email protected] Roll Skia from 0a0c9f8c704f to 51267d4a2cea (21 revisions) (flutter/flutter#177752) 2025-10-30 [email protected] Copy symlinks when creating android cipd package, and update to package w/ symlinks (flutter/flutter#177638) 2025-10-30 [email protected] [web] Add GEMINI.md for web engine customizations (flutter/flutter#177413) 2025-10-30 [email protected] Added computeDryBaseline implementation in RenderAligningShiftedBox (flutter/flutter#171250) 2025-10-29 [email protected] Refactor OverlayPortal semantics (flutter/flutter#173005) 2025-10-29 [email protected] [web] Delete unused canvaskit utils (flutter/flutter#177684) 2025-10-29 [email protected] Fixed image links in //README.md (flutter/flutter#177750) 2025-10-29 [email protected] Disable LTO in CI builder configurations for Linux targets (flutter/flutter#177694) 2025-10-29 [email protected] [web] Move webparagraph tests to their right location (flutter/flutter#177739) 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#171250) <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Implements computeDryBaseline method in RenderAligningShiftedBox to fix layout failures when DropdownButtonFormField is used inside Wrap inside AlertDialog. The method calculates baseline using dry layout methods and accounts for child positioning within the parent's coordinate space. Issue appeared when DropdownButtonFormField was used inside a Wrap inside Alertdialog Fixes [flutter/issues/169214](flutter#169214) ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Tong Mu <[email protected]>
Implements computeDryBaseline method in RenderAligningShiftedBox to fix layout failures when DropdownButtonFormField is used inside Wrap inside AlertDialog. The method calculates baseline using dry layout methods and accounts for child positioning within the parent's coordinate space.
Issue appeared when DropdownButtonFormField was used inside a Wrap inside Alertdialog
Fixes flutter/flutter/issues/169214
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.