Repository navigation
fix: give iOS bottom sheets a native surface and honor their contract - #17
Merged
AdamMusa merged 2 commits intoOct 29, 2026
Merged
Conversation
Non-picker content was shown raw through showCupertinoModalPopup: no surface, grabber, safe area or keyboard inset, and every sheet keyword except dismissible/modal/barrier_color was ignored. The iOS renderer now presents a rounded systemBackground surface with an optional 36x5 grabber, SafeArea, keyboard lift, 9/16 (or full-height when scrollable) sizing, size_constraints/height/padding and drag-to-dismiss. fullscreen pushes the native CupertinoSheetRoute onto the owning navigator. draggable defaults to fullscreen (D-8): page sheets drag, popups do not. The picker panel is unchanged. open: false now pops only the route the sheet presented (also while it is still animating in), the barrier color stays live, and every opened sheet reports exactly one dismiss.
This was referenced Oct 28, 2026
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.
Ruby counterpart: AdamMusa/ruflet#33
Fixes SPEC bug #2 / item D1 (P0): the iOS
BottomSheetignored most of its contract and showed non-picker content raw, with no surface.What it renders
bgcolorCupertinoColors.systemBackground(elevated)show_drag_handle(false)systemGrey3, 6 px above/belowuse_safe_area(true)SafeArea(top: false)inside the surface, so the color runs behind the home indicatormaintain_bottom_view_insets_padding(true)scrollable(false)true= screen minus the top safe insetsize_constraintsConstrainedBoxinside the 9/16 cap (same order as Material)height,paddingdismissible/modal,barrier_colorControlBarrier, as in 1f21fca)draggable(nil)fullscreen(D-8): page sheets drag, popups do notfullscreen(false)CupertinoSheetRoute,enableDrag: draggable ?? true,showDragHandle)elevation,shape,clip_behavior,animation_styleThe surface is
ClipRRect(top 12) > ColoredBox(bgcolor) > SafeArea > Column([grabber?, Flexible(Padding(content))]). Drag-to-dismiss is a small private_CupertinoSheetDragDismiss(D-7). The surface follows the finger. On release it dismisses past 25 % of its height or above 700 px/s, and otherwise springs back. Withscrollable: true, only the top 44 px start a drag, so inner scrollables keep their gestures. Picker, TimerPicker and DatePicker content keeps the existing fixed-height panel unchanged.Wire keys: no new keys. Events:
dismiss, unchanged.Lifecycle (respects the existing
open/on_dismisscontract)open: truepresents the sheet in a post-frame callback, inside the owning navigator (useRootNavigator: falsesemantics, as in 1f21fca).open: falsepops only the route this sheet presented. It usesremoveRouteif something is stacked above it, and never pops whatever happens to be on top. It also works while the entrance animation is still running.dismissand resetsopen, including a sheet closed before its post-frame presentation ran. Ruby untracks dialogs ondismiss(page.rb).Deviations from the spec (intentional)
fullscreenusesNavigator.of(context).push(CupertinoSheetRoute(...))instead ofshowCupertinoSheet.showCupertinoSheetalways pushes onto the root navigator. That breaks the owner's rule (1f21fca) that native presentation is scoped to the owning navigator, and theopen: falsepath could not find the route to pop. The route, transition, drag and handle are the same SDK classes.padding.paddinginsets the content, matching Material, where the handle is outside the content.SizedBox.expand, like Materialfullscreen).height,size_constraints,barrier_color,dismissibleandmodaldo not apply to it: an iOS page sheet has no barrier.Tests
test/widgets/ruby_cupertino_bottom_sheet_test.dart: 22 iOS cases and 4 Android cases. Each iOS case also asserts that no Material widget is present.bgcolor, top radius 12show_drag_handle: grabber rect 36x5, centered, surface.top + 6,systemGrey3use_safe_area: falsemaintain_bottom_view_insets_padding: falsesize_constraints(500x200, centered),height+paddinggeometrydismiss+open=false; 60 px fling at 1500 px/s dismisses; popup withoutdraggablestays (D-8);scrollabledrags only from the top 44 pxmodal/dismissible: falsekeep it openopen: falsepops only the sheet. Rebuilds during the exit animation do not pop the page beneath, inside a nested navigator. Close while animating in, then reopen.fullscreen:CupertinoSheetTransition+CupertinoSheetRoute, handle, surface color, drag-to-dismiss by default,draggable: falseblocks it andopen: falsestill closesBottomSheetcolor/handle, keyboard padding,draggabledrags it away, and it does not drag by default (path untouched)Before the fix, 16 of the 22 iOS cases failed. After it, all 26 pass.
verify_pr.shwith Flutter 3.41.2 against the Ruby counterpart:The audit's BottomSheet parity gap went from 11 Material-only props to the 4 documented iOS-ignored ones (
animation_style clip_behavior elevation shape). The existingmodal_presentation_test.dart, the matrix and the architecture tests are unchanged and pass.Ruby usage