Skip to content

[material_ui] Fix showModalBottomSheet safe area on display-feature sub-screens - #13428

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
JiyadAhammad:fix-195218-bottom-sheet-safe-area
Nov 20, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:mainfrom
JiyadAhammad:fix-195218-bottom-sheet-safe-area

Conversation

@JiyadAhammad

Copy link
Copy Markdown
Contributor

Fixes flutter/flutter#195218

Description

When showModalBottomSheet(useSafeArea: true) is displayed on a display-feature sub-screen (such as on foldable or dual-screen devices), ModalBottomSheetRoute.buildPage previously wrapped the outer DisplayFeatureSubScreen with SafeArea.
Because SafeArea was on the outside, it read the full-screen MediaQuery.padding (e.g. an edge camera cutout on the opposite side of the unfolded device). This added padding to the root container and shifted the bottom sheet when placed on the sub-screen.
This moves the useSafeArea / MediaQuery.removePadding wrapping inside DisplayFeatureSubScreen's Builder, so SafeArea receives the sub-screen's adjusted MediaQueryData and only avoids insets belonging to that specific sub-screen.

Tests

  • Added regression unit test in packages/material_ui/test/bottom_sheet_test.dart: showModalBottomSheet(useSafeArea: true) does not apply safe area from opposite sub-screen.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exceptions] apply.

Footnotes

  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. ↩

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies ModalBottomSheetRoute in bottom_sheet.dart to apply SafeArea or remove top padding inside the DisplayFeatureSubScreen's builder. This ensures the sheet receives the sub-screen's adjusted MediaQueryData instead of the root window padding, preventing safe area padding from the opposite sub-screen of a foldable device from being applied. A regression test has been added to verify this behavior, and the package version is bumped to 1.8.1. There are no review comments, and I have no feedback to provide.

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 3, 2026
@JiyadAhammad
JiyadAhammad force-pushed the fix-195218-bottom-sheet-safe-area branch from e4be56c to a4121b6 Compare November 5, 2026 17:02
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 5, 2026
@JiyadAhammad

Copy link
Copy Markdown
Contributor Author

Hi @QuncCccccc @elliette , I have cleanly rebased on the latest main, bumped the package version to 1.10.1, and updated the changelog to resolve the earlier check issues. Could you please re-apply the CICD label to kick off the tests? Thank you!

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! material_ui uses batch release, so CHANGELOG.md and the version in pubspec.yaml shouldn't be changed directly. That's why "Repository standards validation" failed earlier. Could you revert the changes to those two files and add a pending changelog file in packages/material_ui/pending_changelogs/ instead? You can copy template.yaml and fill it in with version: patch. See the "The flutter/packages changelog file" section in flutter/flutter#188444 for details.

@JiyadAhammad
JiyadAhammad force-pushed the fix-195218-bottom-sheet-safe-area branch from a4121b6 to af5749d Compare November 6, 2026 01:18
@JiyadAhammad

Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out @QuncCccccc I've reverted the changes to pubspec.yaml and CHANGELOG.md, and added the pending changelog file with version: patch. Let me know if everything looks good now.

@elliette elliette added the CICD Run CI/CD label Nov 10, 2026

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Left a comment around testing, but overall looks good!

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 11, 2026
@elliette elliette added the CICD Run CI/CD label Nov 11, 2026

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the tests, LGTM!

@JiyadAhammad

Copy link
Copy Markdown
Contributor Author

Thank you @elliette for the review and approval, and thanks for applying the CICD label! All checks are now green.

@QuncCccccc please let me know if there are any remaining changes needed on your end, or if this is good to be labeled with autosubmit to merge. Thanks again for your time!

@Hari-07 Hari-07 added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 20, 2026
@auto-submit
auto-submit Bot merged commit 7a7349e into flutter:main Nov 20, 2026
14 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Nov 20, 2026
…er#197056)

flutter/packages@81b7c44...898818d

2026-11-20 [email protected] [material_ui] Use correct time format for
Sinhala locale (flutter/packages#13645)
2026-11-20 [email protected] [material_ui]
Fix showModalBottomSheet safe area on display-feature sub-screens
(flutter/packages#13428)
2026-11-20 [email protected] [material_ui]
Fix M3 doc errors in the `ElevatedButton` and `FilledButton`
(flutter/packages#13685)
2026-11-19 [email protected] [video_player] Convert implementation
to Kotlin (flutter/packages#13683)
2026-11-19 [email protected] [flutter_svg] Add
SvgLoader.provideSvgInIsolate for unsendable loaders
(flutter/packages#13598)
2026-11-19 [email protected] [VPAT] Expose modal drawers with the
dialog semantics role (flutter/packages#13660)
2026-11-19 [email protected] [VPAT] Keep a11y_assessments tooltips
open while hovered (flutter/packages#13657)
2026-11-19 [email protected] [flutter_svg] Stabilize network SVG cache
keys (flutter/packages#13597)
2026-11-19 [email protected]
[image_picker_ios] Return an error instead of an empty file when an
image cannot be saved (flutter/packages#12998)
2026-11-19 [email protected] [cupertino_ui]
Fix CupertinoNavigationBarBackButton assertion debug
(flutter/packages#13397)
2026-11-19 [email protected] [go_router] Document when
GoRouterState.name and path are null (flutter/packages#13486)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[material_ui] showModalBottomSheet(useSafeArea: true) subtracts the opposite safe area from a sheet on a display-feature sub-screen

4 participants