Repository navigation
Fix BottomAppBar notch position when the bar has a margin - #7024
Draft
ndonkoHenri wants to merge 3 commits into
Draft
ndonkoHenri wants to merge 3 commits into
ndonkoHenri wants to merge 3 commits into
Conversation
A page-level golden test with a centre-docked FloatingActionButton and a BottomAppBar with left, top and right margins. The small window keeps the bar large in the screenshot: without the fix the notch is cut 40 px to the right and 16 px too deep, and similarity drops to 98.6%, below the 99% threshold.
Contributor
|
Sorry @ndonkoHenri, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 1 day and 13 hours by commenting |
Deploying flet-website-v2 with
|
| Latest commit: |
da7e594
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://623092d8.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-bottom-app-bar-notch-mar.flet-website-v2.pages.dev |
BottomAppBar notch position when the bar has a margin
ndonkoHenri
marked this pull request as draft
October 29, 2026 09:57
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6986.
A
BottomAppBarwith amargincuts its notch away from a dockedFloatingActionButton: with the reporter'smargin=ft.Margin.only(left=40, right=40, bottom=28), the notch sits 40 px to the right of the button, and a top margin makes it as much too deep.Cause
Flutter cuts the notch from the FAB's position, which
Scaffoldreports relative to the whole bottom slot. Flet appliesmarginaround the bar, so the bar startsmargin.left/margin.topinto that slot, but the notch is cut in the bar's own coordinates without accounting for that.Fix
BottomAppBarControlwraps the notch shape in_OffsetNotchedShape, which shifts the FAB's rectangle by(-margin.left, -margin.top)before cutting. Without a shape or a left/top margin, the shape is passed through unchanged. It works for every notch shape (CircularRectangleNotchShape,AutomaticNotchShape), since it moves the guest rectangle rather than the shape. Right and bottom margins don't move the bar's origin, so they don't affect the notch.The issue asks for
dx/dyoffset properties on the notch shapes. With this fix they aren't needed: the offset follows the margin automatically, including when the margin animates.Testing
test_notch_with_marginincontrols/material/test_bottom_app_bar.py: a centre-docked FAB over a bar with left, top and right margins, on a small page. It passes with the fix (100% similarity) and fails without it (98.6%, below the 99% threshold). The window is small on purpose; at 400×300 the shifted notch was too small a share of the screenshot to drop below the threshold.Summary by Sourcery
Keep BottomAppBar notches aligned with docked floating action buttons when margins are applied.
Bug Fixes:
Tests: