Skip to content

fix(app): keep the bottom tab bar above the Android system navigation bar - #12858

Merged
undivisible merged 4 commits into
BasedHardware:mainfrom
woahwhattheheck:fix/android-3button-nav-bar-overlap
Sep 7, 2026
Merged

undivisible merged 4 commits into
BasedHardware:mainfrom
woahwhattheheck:fix/android-3button-nav-bar-overlap

Conversation

@woahwhattheheck

@woahwhattheheck woahwhattheheck commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #12352

What

On Android with 3-button navigation, the home tab row (Home / Conversations / Tasks / Apps) is drawn underneath the system navigation bar, so the icons are covered and the taps land on back/home/recents instead.

Why it happens

BottomNavBar reserves no bottom safe-area inset:

height: 100,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 0),   // bottom: 0

It is mounted directly into the home Scaffold.body Stack, and there is no SafeArea, MediaQuery.removePadding or bottomNavigationBar anywhere on that path — so the body keeps the full window inset.

app/android/app/build.gradle sets targetSdkVersion 36. The four styles.xml still set android:windowOptOutEdgeToEdgeEnforcement=true, but per Android 16 behavior changes that attribute is "deprecated and disabled" for apps targeting API 36, so on an Android 16 device the app goes edge-to-edge regardless and the body extends to the physical screen edge. On Android 15 the opt-out still holds, the system insets the window itself, and the reserved inset is 0 — the layout is unchanged there.

The container is 100dp with 20dp top padding, leaving an 80dp content box whose tap targets sit against the screen bottom. A 3-button navigation bar is ~48dp and opaque, so it covers most of that band. Under gesture navigation the inset is only ~16-24dp, which is why the report is specific to 3-button mode.

The two sibling bottom-anchored bars mounted in the same Stack — MergeActionBar and TaskSelectionActionBar — already wrap their content in SafeArea. BottomNavBar is the one that omits the inset.

The change

  • app/lib/widgets/bottom_nav_bar.dart — add MediaQuery.viewPaddingOf(context).bottom to the container height and bottom padding. The 80dp content box is untouched and the gradient still paints to the screen edge, so nothing shows through behind a translucent system bar. On a device reporting a zero bottom inset the rendered layout is byte-identical to today.
    viewPadding rather than padding: the home Scaffold sets resizeToAvoidBottomInset: false, and padding.bottom collapses to zero while a keyboard is open, which would drop the row back under the system bar.
  • app/lib/pages/home/page.dart — the home-tab chat bar is Positioned(bottom: 78) in the same Stack, anchored against the nav row. It carries the same inset so the existing 38dp gap is preserved instead of the chat bar colliding with the lifted row.
  • app/test/widgets/bottom_nav_bar_test.dart — regression test.

Three lines of behaviour; the rest is comments and the test.

Verification

app/test/widgets/bottom_nav_bar_test.dart gains keeps the tab row clear of the system navigation bar inset, which pumps the bar under a 0dp and a 48dp bottom viewPadding and asserts:

  1. every tab icon's bottom edge is at or above screenBottom - 48 — i.e. clear of the system navigation band;
  2. the row lifts by exactly the reported inset, so a zero-inset device keeps today's layout.

Geometry, which is what makes (1) fail on main: the icon is centred in the 80dp content box, so its bottom sits at screenBottom - inset - 27. With the fix and a 48dp inset that is screenBottom - 75, comfortably clear. Without the fix the inset term drops out and it stays at screenBottom - 27, which is 21dp inside the 48dp system band — so the first assertion fails on main and passes here. It is a real regression test, not a tautology.

I do not have an Android device or a Flutter toolchain in this environment, so I have not run flutter test, make preflight or scripts/pr-preflight myself and I am not claiming a device repro. The change was derived from the source and the reporter's screenshot; please let CI run the suite, and I will fix anything it turns up. If you would like a physical-device confirmation before merging, say so and I will arrange one rather than guess.

Failure-Class: new

FC-bottom-control-under-system-inset, added in .github/failure-classes/ in this change.

Root cause. Edge-to-edge is not opt-in any more — it follows from targetSdk >= 35. A bottom-anchored control therefore cannot assume the window ends where the screen's usable area ends. BottomNavBar was written against the older model where the framework inset the window, so a bare height: 100 was sufficient; once the window grew, the same constant silently moved the tap targets into the system bar's band. Nothing failed loudly, because painting still succeeded — only the hit-testing moved.

Durable guard. The canonical prevention artifact is app/test/widgets/bottom_nav_bar_test.dart, which asserts clearance against a non-zero bottom viewPadding rather than asserting a fixed height. A future change to the bar's geometry stays correct as long as the inset is respected, and any reintroduction of a screen-edge-anchored tap target fails the clearance assertion. The class's scope hints cover the nav bar and the home page so the same check is reached for the siblings positioned against it.

The distinction from the two neighbouring classes: FC-ancestor-chrome-steals-control-taps is an in-app ancestor absorbing hits, and FC-transparent-top-level-window-occlusion is a macOS window owning area beyond its visible surface. This one is the OS system bar occupying a band the app never reserved.

Invariants

None named. INV-UI-1 globs app/lib/** but states it should not be named in routine UI PRs — this touches no brand colour or accent. The other invariants with app-facing names (INV-CHAT-1, INV-CHAT-2, INV-NAV-1) glob desktop/** only, and this change touches no desktop path.

… bar

BottomNavBar reserved no bottom safe-area inset, so on Android 15+ (targetSdk 36 enforces edge-to-edge) its tap targets were drawn under the system navigation bar. In 3-button mode that bar is ~48dp and opaque, covering most of the tab row.

Reserve MediaQuery.viewPaddingOf(context).bottom in the nav container and carry the same inset on the home chat bar positioned against it. A device reporting a zero bottom inset lays out exactly as before.

Fixes BasedHardware#12352
Drop unnecessary interpolation braces (flutter_lints), tolerate sub-pixel
layout rounding, and key the bar per pump so the cached _navigation
subtree is rebuilt for each inset rather than reusing the element.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found and verified against the latest diff

Confidence score: 4/5

  • app/lib/widgets/bottom_nav_bar.dart appears to rely on an edge-to-edge premise contradicted by the app’s Android themes, including the runtime NormalTheme; the fix may therefore fail to address the intended navigation-bar behavior. Verify the active theme configuration and adjust the fix or add runtime coverage.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/lib/widgets/bottom_nav_bar.dart">

<violation number="1" location="app/lib/widgets/bottom_nav_bar.dart:41">
P2: The fix's stated premise is contradicted by the app's own Android theme. All four `app/android/app/src/main/res/**/styles.xml` (including the runtime `NormalTheme`) set `android:windowOptOutEdgeToEdgeEnforcement=true`, which opts the app out of the Android 15+ enforced edge-to-edge that the added comment claims "SDK 36 ... enforces edge-to-edge and this Stack extends under the system navigation bar." The code unconditionally adds `MediaQuery.viewPaddingOf(context).bottom`; if the window is not actually drawn under the nav bar (or reports the inset differently under opt-out), this either does not fix the reported issue or double-lifts the row off the bottom. Before relying on this approach, reconcile the fix with the `windowOptOutEdgeToEdgeEnforcement=true` theme (or update the theme) and verify the runtime inset behavior it depends on.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/widgets/bottom_nav_bar.dart Outdated
// viewPadding, not padding: the home Scaffold sets
// resizeToAvoidBottomInset: false, and padding.bottom collapses to zero
// while a keyboard is open, which would drop the row back under the bar.
final bottomInset = MediaQuery.viewPaddingOf(context).bottom;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The fix's stated premise is contradicted by the app's own Android theme. All four app/android/app/src/main/res/**/styles.xml (including the runtime NormalTheme) set android:windowOptOutEdgeToEdgeEnforcement=true, which opts the app out of the Android 15+ enforced edge-to-edge that the added comment claims "SDK 36 ... enforces edge-to-edge and this Stack extends under the system navigation bar." The code unconditionally adds MediaQuery.viewPaddingOf(context).bottom; if the window is not actually drawn under the nav bar (or reports the inset differently under opt-out), this either does not fix the reported issue or double-lifts the row off the bottom. Before relying on this approach, reconcile the fix with the windowOptOutEdgeToEdgeEnforcement=true theme (or update the theme) and verify the runtime inset behavior it depends on.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/widgets/bottom_nav_bar.dart, line 41:

<comment>The fix's stated premise is contradicted by the app's own Android theme. All four `app/android/app/src/main/res/**/styles.xml` (including the runtime `NormalTheme`) set `android:windowOptOutEdgeToEdgeEnforcement=true`, which opts the app out of the Android 15+ enforced edge-to-edge that the added comment claims "SDK 36 ... enforces edge-to-edge and this Stack extends under the system navigation bar." The code unconditionally adds `MediaQuery.viewPaddingOf(context).bottom`; if the window is not actually drawn under the nav bar (or reports the inset differently under opt-out), this either does not fix the reported issue or double-lifts the row off the bottom. Before relying on this approach, reconcile the fix with the `windowOptOutEdgeToEdgeEnforcement=true` theme (or update the theme) and verify the runtime inset behavior it depends on.</comment>

<file context>
@@ -28,12 +28,25 @@ class _BottomNavBarState extends State<BottomNavBar> {
+        // viewPadding, not padding: the home Scaffold sets
+        // resizeToAvoidBottomInset: false, and padding.bottom collapses to zero
+        // while a keyboard is open, which would drop the row back under the bar.
+        final bottomInset = MediaQuery.viewPaddingOf(context).bottom;
         return Align(
           alignment: Alignment.bottomCenter,
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch on the theme — you're right that all four styles.xml, including the runtime NormalTheme, set android:windowOptOutEdgeToEdgeEnforcement=true. My comment overstated the premise, and I've softened it in 6146485.

The conclusion holds, though, because that attribute stops working in exactly the configuration this bug was reported from. From Android 16 behavior changes:

For apps targeting Android 16 (API level 36), R.attr#windowOptOutEdgeToEdgeEnforcement is deprecated and disabled, and your app can't opt-out of going edge-to-edge.

build.gradle sets targetSdkVersion 36, so:

  • Android 16+ device — opt-out disabled, window goes edge-to-edge, bottom viewPadding is the ~48dp 3-button bar. The bug reproduces and the fix engages. This is the reporter's case.
  • Android 15 device — opt-out still honored, the system insets the window itself, so the window never extends under the bar and bottom viewPadding is 0. 100 + 0 is the current layout, byte for byte.

On double-lifting: it can't happen, because the value read is the inset the window actually reports. If the system has already inset the window, there is no bottom viewPadding left to reserve. The change only ever engages when the window really does extend under the bar, which is why the comment now says "whatever bottom inset the window reports" instead of asserting enforcement.

Worth noting separately: those four opt-out lines are already dead on Android 16 by the quote above. Removing them is the right cleanup, but it changes inset behaviour for every screen in the app on Android 15, so it belongs in its own PR rather than riding along with a tab-bar fix.

Comment thread app/lib/pages/home/page.dart Resolved
- Make the regression test discriminate viewPadding from padding. The old
  helper set both to the same value, so it passed even if the bar read
  paddingOf. A second case now pins the keyboard-open state: padding zero,
  viewPadding at the system bar height.
- Derive the home chat bar's offset from the nav row's own geometry
  (kBottomNavBarHeight / kBottomNavChatBarGap / bottomNavBarReservedInset)
  so the two cannot drift apart.
- Soften the edge-to-edge comment: the reserved inset is whatever the
  window reports, so a window that is not drawn under the system bar
  reports zero and the row is never lifted twice.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Solid, well-tested Android edge-to-edge inset fix (fixes #12352), root cause clearly identified, regression test proves the fix on main's geometry. Approving but not merging: 'PR Metadata Preflight' is a real failing required check — the body's Failure-Class line is written as a markdown header ('## Failure-Class: new') and the automated parser needs the literal 'Failure-Class: new' line, so it isn't recognized. Author (or a maintainer) needs to fix the body formatting before this can merge.

@woahwhattheheck

Copy link
Copy Markdown
Contributor Author

Thanks for the approval. The PR body now has the literal Failure-Class: new line; the Hygiene log reported the same missing declaration. Commit 95f65686329395b4d823ad9f9438321d0b1eee30 also collapses the flagged page.dart expression to the 120-column format. This commit changes whitespace only; all non-whitespace source characters are unchanged.

The existing Dart Analyze & Tests and Android Compile Smoke passed at the preceding 6146485 head. Those results are retained, and no tests were manually rerun.

The new Repo Checks and Mobile App Checks are currently action_required. Maintainer workflow approval is the remaining gate to validating the metadata/formatting cleanup and merging.

@undivisible
undivisible merged commit 716942c into BasedHardware:main Sep 7, 2026
25 checks passed
Git-on-my-level added a commit that referenced this pull request Sep 17, 2026
…44pt touch targets, single-counted insets (#14312)

* fix(app): seat the bottom tab row directly on the system inset

#12858 reserved the window's bottom view padding under the home tab bar, which
was right for Android's 3-button bar, but it added the inset beneath a 100pt
bar that already kept ~27pt of empty space under its icons. On an iPhone the
two gaps stack: the icons sit ~74pt above the screen edge, against ~59pt for a
platform tab bar (UITabBar is a 49pt row on the 34pt safe area).

Split the bar into a 20pt fade and a 52pt tab row that ends exactly where the
inset begins, so the inset is the only space under the row on every device
(34pt home indicator, 16-48dp Android gesture pill / 3-button bar, or zero).
The gradient's fade stop is now derived from the fade height instead of a
fraction of a height that grows with the inset.

Everything tuned to the old 100pt literal now derives from the bar: the home
chat bar offset, the home/conversations/tasks/apps trailing scroll spacers and
the Tasks FAB. Those literals ignored the system inset entirely, so on an
inset device the last list row ended 34-48pt under the bar, and the apps
search results (bottom: 64) under-cleared it on every device.

Failure-Class: FC-bottom-control-under-system-inset

Verified: flutter test test/widgets/bottom_nav_bar_test.dart (6 passed); the
new geometry test fails with kBottomNavRowHeight restored to 80.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* feat(app): announce the icon-only bottom tabs to screen readers

The four home tabs are bare icons, and their label strings were only ever sent
to analytics, so VoiceOver and TalkBack read nothing for the app's primary
navigation. Give each tab a localized label with button and selected state.
Conversations, Tasks and Apps reuse existing keys; Home is a new key,
translated in all 49 locales (gen-l10n reports the same two pre-existing
untranslated keys, memoryAllowUse / memoryDontUse, and no new ones).

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(app): give the home shell's small controls full-size touch targets

Apple's HIG asks for 44x44pt hit targets and Material for 48dp. The home
shell's most-used controls were well under both, because each one's touch
target was exactly the small shape it painted:

- all seven header buttons (settings, search, date filter, sync, task export,
  show-completed, create-app): 36x36, 8pt apart
- the "+" buttons for folders and goals (both tabs): 32x32
- conversation filter chips: 36pt tall
- the "clear completed" x on a task section: a bare 14pt icon, and the
  smallest target in the app guards a destructive action
- the section collapse chevrons: ~19pt tall with dead gaps between icon and
  label
- the chat bar's mic: 42pt, nested in the chat bar's own target, so a near
  miss opened text chat instead of voice

HeaderCircleButton keeps the painted circle and centers it in a 44pt target;
surrounding margins shrink by the overhang so nothing moves on screen. Chips
pad themselves inside a 44pt strip that still occupies 52pt. Task section
headers move their vertical padding inside each child so the tappable ones own
the header's full 36pt height (a task row starts 4pt below, so there is no
room for 44) and reach sideways into the Spacer. The mic owns the chat bar's
full height and rounded end.

Every converted control also gets a localized screen-reader label from
existing keys; none had one.

Verified: flutter test test/widgets/header_circle_button_test.dart
test/widgets/folder_tabs_tap_target_test.dart
test/widgets/goals_widget_performance_test.dart (all passed).

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(app): reserve the bottom inset once on onboarding and transcription bars

Seven onboarding cards (sign-in, AI consent, name, language, permissions,
permissions checker, speech profile) and both bottom bars on the transcription
settings page added MediaQuery.padding.bottom to their own padding and then
wrapped their content in SafeArea(top: false), which adds the same inset again.
Nothing above them consumes it, so on an iPhone the primary button floated over
2 x 34 + 8 = 76pt of dead space; on Android 16 with a 3-button bar, 104dp.

Drop the manual term and let the SafeArea own the inset. Devices that report no
inset lay out exactly as before.

Failure-Class: FC-bottom-control-under-system-inset

Verified: flutter test test/widgets/onboarding_bottom_inset_test.dart passes;
with the name card's old padding restored it fails with 68.0 where 34.0 is
expected.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(app): keep the conversation bar above Android's 3-button navigation bar

The conversation detail page floats its tab/play bar at a literal bottom: 32
over an extendBody Scaffold. That clears the iPhone home indicator, but Android
16 enforces edge-to-edge (targetSdk 36) and draws a 3-button navigation bar up
to 48dp tall over the same strip, covering the lower 16dp of the bar's buttons.
The bar now never sits lower than the bottom inset the window reports. iPhone
moves by 2pt (32 -> 34); devices with a smaller or zero inset do not move.

Failure-Class: FC-bottom-control-under-system-inset

Verified: flutter test test/unit/detail_floating_bar_offset_test.dart passes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

Bottom tab bar hidden behind Android 3-button system navigation bar

3 participants