Skip to content

Fix BottomAppBar notch position when the bar has a margin - #7024

Draft
ndonkoHenri wants to merge 3 commits into
flet-1.1.0from
fix/bottom-app-bar-notch-margin-6986
Draft

ndonkoHenri wants to merge 3 commits into
flet-1.1.0from
fix/bottom-app-bar-notch-margin-6986

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6986.

A BottomAppBar with a margin cuts its notch away from a docked FloatingActionButton: with the reporter's margin=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 Scaffold reports relative to the whole bottom slot. Flet applies margin around the bar, so the bar starts margin.left / margin.top into that slot, but the notch is cut in the bar's own coordinates without accounting for that.

Fix

BottomAppBarControl wraps 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/dy offset properties on the notch shapes. With this fix they aren't needed: the offset follows the margin automatically, including when the margin animates.

Testing

  • New golden test test_notch_with_margin in controls/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.
  • The reporter's sample, run as a web app with web clients built before and after the fix: the notch moves from 40 px right of the button to centred under it.
  • A pixel-scanning widget test (not committed) with no margin, the reporter's margins, a top margin of 16 and a left margin of 80: the notch is centred under the FAB in every case after the fix, with the right depth.

Summary by Sourcery

Keep BottomAppBar notches aligned with docked floating action buttons when margins are applied.

Bug Fixes:

  • Correct the BottomAppBar notch position when left or top margins offset the bar from a docked FloatingActionButton.

Tests:

  • Add a golden test verifying that a margin-bearing BottomAppBar keeps its notch centered under the docked FloatingActionButton.

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.
@sourcery-ai

sourcery-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
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 @sourcery-ai review. Upgrade to get a review now.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

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

View logs

@ndonkoHenri ndonkoHenri changed the title Fix BottomAppBar notch position when the bar has a margin Fix BottomAppBar notch position when the bar has a margin Oct 29, 2026
@ndonkoHenri
ndonkoHenri marked this pull request as draft October 29, 2026 09:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant