Skip to content

fix: keep the iOS View bottom sheet above the navigation bar - #66

Merged
AdamMusa merged 1 commit into
codex/engine-initializationfrom
fix/cupertino-view-bottom-sheet-tab-bar
Nov 2, 2026
Merged

AdamMusa merged 1 commit into
codex/engine-initializationfrom
fix/cupertino-view-bottom-sheet-tab-bar

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Engine-only fix with no Ruby change. QA found it while reviewing ruflet #27, which exposes View bottom_sheet in Ruby.

Bug

On iOS/macOS, a View's persistent bottom_sheet slot (PlatformPageScaffold.bottomSheet, from view.dart:210) was aligned to the bottom of the whole scaffold content in RufletCupertinoPageScaffold, which includes the bottom navigation_bar. So the sheet was drawn on top of the tab bar and covered it.

Material's Scaffold.bottomSheet sits above bottomNavigationBar and floats over the body. That is the reference behaviour.

Measured on base c9b9d76 (800x600, 34 px home indicator): iOS sheet bottom = 566 and nav bar top = 516, so the sheet covered the bar.

Fix

lib/src/widgets/cupertino_page_scaffold.dart _buildContent():

  • The body and the bottom sheet now share an inner Stack: the body fills it and the sheet is aligned to its bottom.
  • That Stack is the Expanded region above the bottom navigation bar, so the sheet stands on the bar, as in Material.
  • The inner Stack is always built, so showing or hiding the sheet keeps the body's element and state.
  • The scaffold-level SafeArea is unchanged. The bottom inset still applies to the bar, or to the sheet when there is no bar.

The FAB and drawer layers are unchanged. Reading the code, the Cupertino FAB is still aligned over the whole content, so it can also overlap a bottom navigation bar. QA did not report that, so it is not changed here and is flagged as a possible follow-up.

Wire keys / Ruby usage

No wire change: View bottom_sheet + navigation_bar.

Ruflet.view(
  [cart_list],
  route: "/cart",
  navigation_bar: navigation_bar(destinations: [...]),
  bottom_sheet: container(content: text_button("Checkout", on_click: ->(e) {}), padding: 12)
)
Material Cupertino (before) Cupertino (after)
sheet vs nav bar sheet.bottom == nav.top (486) sheet covers the bar (bottom 566, bar 516..566) sheet.bottom == nav.top (516)
no nav bar runs to the screen edge (Flutter reference, unchanged) above the home indicator (566) above the home indicator (566)

Tests

New test/widgets/view_bottom_sheet_geometry_test.dart renders a real Ruby-shaped View through PlatformApp, with 54/34 px insets, on both designs:

  • with navigation_bar:
    • the sheet is 64 high and sheet.bottom == nav.top
    • the destination labels are below the sheet and above the 34 px inset
    • the body content is visible above the sheet
    • iOS has no Material widgets; Material has no CupertinoPageScaffold
  • without a nav bar:
    • iOS: sheet.bottom == 600 - 34 and its content stays above the inset
    • Material: the reference behaviour is locked (sheet bottom 600)

Before the fix, only the iOS nav-bar case failed (expected 516, actual 566). After it, all 4 pass, and the existing platform_page_scaffold_test (including "body clears navigation chrome exactly once") and canonical_page_chrome_test still pass.

verify_pr.sh (Flutter 3.41.2; Ruby tree = clean origin/main b34072be because Ruby is unchanged):

PASS ruby:ruflet_core                   145/145 files, 618 runs
PASS engine:ruflet flutter test         +699: All tests passed!   (695 base + 4 new)
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     NEW vs baseline: 0, fixed: 0

The persistent View bottom_sheet was aligned to the bottom of the whole
Cupertino scaffold content, which includes the bottom navigation bar,
so it covered the tab bar. Like Material's Scaffold.bottomSheet it now
floats over the body inside the region above the navigation bar; the
scaffold SafeArea still keeps it above the home indicator when there is
no bar.
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