Skip to content

fix: accept the iOS sheet keywords on cupertino_bottom_sheet - #33

Merged
AdamMusa merged 2 commits into
mainfrom
fix/cupertino-bottom-sheet-parity
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
mainfrom
fix/cupertino-bottom-sheet-parity

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Engine counterpart (renderer fix): AdamMusa/ruflet-engine#17

Item D1 (P0), keyword parity. The canonical bottom_sheet contract (PlatformControlContracts::Components::BottomSheetControl) already accepted every iOS sheet keyword. The deprecated cupertino_bottom_sheet spelling rejected most of them with ArgumentError.

Change

controls/cupertinos/cupertinobottomsheet_control.rb now accepts:
barrier_color dismissible draggable fullscreen maintain_bottom_view_insets_padding scrollable show_drag_handle size_constraints use_safe_area (alphabetical in initialize, copied only when non-nil).

None of them gets a Ruby default. This matters for draggable: the iOS renderer derives its default from fullscreen (decision D-8, page sheets drag and popups do not). Material-only keys (elevation shape clip_behavior animation_style) are still rejected on the Cupertino spelling, because the iOS renderer ignores them.

Wire keys: unchanged (Ruby keyword = wire key). Event: on_dismiss → "dismiss", unchanged.

Material vs Cupertino (rendered by the engine PR)

  • iOS: a rounded systemBackground surface with optional grabber, safe area, keyboard lift, 9/16 or scrollable sizing, size_constraints/height/padding, and drag-to-dismiss when draggable. fullscreen: true opens the native stacked page sheet, which drags by default.
  • Android/web/desktop: Material showModalBottomSheet, unchanged.

Usage

sheet = bottom_sheet(
  content: column(controls: [text("Share"), text_field(label: "Note")]),
  show_drag_handle: true,
  draggable: true
)
page.show_bottom_sheet(sheet)
page.close_bottom_sheet # pops just this sheet, then on_dismiss fires once

page.show_bottom_sheet(bottom_sheet(content: settings_form, fullscreen: true)) # iOS page sheet
cupertino_bottom_sheet(text("Legacy spelling"), fullscreen: true, use_safe_area: false) # now accepted

Tests

test/cupertino_bottom_sheet_compatibility_test.rb, with 5 new tests:

  • every iOS keyword serializes on cupertino_bottom_sheet
  • neither bottom_sheet nor cupertino_bottom_sheet sends a default for these keys
  • every legacy keyword is in the canonical contract, and each iOS keyword is in both
  • canonical bottom_sheet serializes bgcolor height padding fullscreen show_drag_handle
  • Material-only elevation is rejected on the Cupertino spelling

Before the change: 1 failure and 1 error. After it: 9 runs, 138 assertions, 0 failures.

verify_pr.sh (Ruby 4.0.5 + Flutter 3.41.2, against the engine PR):

PASS ruby:ruflet_core                   145/145 files, 623 runs
PASS engine:ruflet flutter test         +721: All tests passed!
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     NEW vs baseline: 0

The legacy cupertino_bottom_sheet spelling rejected draggable,
dismissible, fullscreen, scrollable, show_drag_handle, use_safe_area,
maintain_bottom_view_insets_padding, size_constraints and barrier_color,
which the canonical bottom_sheet contract already accepts and the iOS
renderer now honors. None of them gets a Ruby default, so the renderer
can derive draggable from fullscreen.
@AdamMusa
AdamMusa merged commit 2420584 into main Oct 29, 2026
5 checks passed
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