Repository navigation
Fix MenuAnchor scrollbar safe area padding - #191085
abdullahtas0 wants to merge 1 commit into
Conversation
|
This pull request contains changes to Material or Cupertino, which are currently frozen in this repository. Changes should be made in Please refer to #188444 for instructions. |
|
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. |
|
Superseded by flutter/packages#12470. Material framework changes now need to land in the standalone material_ui package, so I am closing this draft in favor of the packages PR. |
Material `Scrollbar` uses the surrounding `MediaQuery.padding` as painter padding when no explicit padding is provided. A `MenuAnchor` overlay is already positioned within the safe area, so inheriting the view padding again shortens the scrollbar track and prevents the thumb from reaching its visual end. This change removes safe-area padding only for the menu's `Scrollbar`, then restores the original `MediaQueryData` below it so custom menu children continue to observe the same media query values as before. It also adds a regression test and a patch changelog entry. Fixes flutter/flutter#188155. This supersedes flutter/flutter#191085, which cannot land in `flutter/flutter` because Material framework changes have moved to `material_ui`. Validation: - The regression test failed before the source change with a 24 logical pixel bottom scrollbar padding and passes after the change. - `flutter test test/menu_anchor_test.dart` (171 passed, 1 skipped) - `flutter analyze --no-pub` - `flutter_plugin_tools format --packages=material_ui` - `flutter_plugin_tools validate --packages=material_ui --check-for-missing-changes` ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
MenuAnchor's internalScrollbarinherited the root view'sMediaQuery.padding. On devices with system safe-area padding, this inset the thumb inside the already-positioned menu and prevented it from reaching the end of the menu track.This change removes the view padding for the scrollbar only, while restoring the original
MediaQueryDatafor custom menu content. It also adds a regression test that verifies both behaviors.Fixes #188155.
Pre-launch Checklist
Validation
./bin/flutter test packages/flutter/test/material/menu_anchor_test.dart(171 passed, 1 skipped)./bin/flutter analyze --no-pub packages/flutter(no issues)./bin/dart format packages/flutter/lib/src/material/menu_anchor.dart packages/flutter/test/material/menu_anchor_test.dart(no changes)