-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
base: master
Are you sure you want to change the base?
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
…uteDryLayout and remove unused aligning_shifted_box_baseline_test.dart in material directory
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 moving the integration tests! It looks like it's thoroughly tested now.
Check out the failures, it looks like there is a legitimate problem with how the dry baseline is calculated.
…dded . at the end of comments
…ftedBox, and refactor size calculations in overflow boxes.
…nedBox, covering various scenarios and edge cases
…s for computeDryBaseline with improved BoxConstraints
… this PR and removed test that I created
…al, to resolve testing errors
…ut(constraints) instead of manually calculating
…consistency also fixed computeDistanceToActualBaseline to make flutter test packages/flutter/test/material/toggle_buttons_test.dart pass
…ine to RenderAnimatedSize for improved layout handling, also _RenderInputPadding _computeSize switched up height & width
…accurate size calculations
rendering/flex: Add dry baseline simulation helpers mirroring performLayout. In horizontal baseline mode, align children without baselines to the top (ignore verticalDirection) and mirror in dry path. rendering/shifted_box: RenderPadding.computeDryBaseline: return child baseline + padding.top; null if child has none. RenderSizedOverflowBox.computeDistanceToActualBaseline: include child offset.dy when present. Tidy base comment in RenderShiftedBox.computeDryBaseline. rendering/proxy_box: computeDryBaseline: use child’s dry baseline when available, otherwise fall back to super. material/badge: _RenderBadge: implement computeDryLayout and computeDryBaseline to mirror performLayout (alignment, explicit offset, label vertical shift). material/time_picker: _RenderInputPadding.computeDryBaseline: compute center offset using dry size and add to child baseline. semantics/binding: Safely invoke platformDispatcher.setSemanticsTreeEnabled in tests via dynamic call, ignore when unavailable. Rationale: Make computeDryBaseline match actual layout offsets across wrappers. Fix baseline alignment invariants in Flex and wrappers. Eliminate “computeDistanceToActualBaseline differs from computeDryBaseline” assertions. Tests: rendering/flex “children with no baselines are top-aligned” passes. material badge/time_picker baseline assertions resolved. No functional changes to Cupertino filter behavior. currently only flutter test packages/flutter/test/cupertino/popup_surface_test.dart -p vm --plain-name 'Saturation is applied before blur' fails
… for size calculation instead of computeDryLayout
…uteDryLayout with getDryLayout
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 Dropdownfield 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.