Skip to content

Forward showDragHandle from showCupertinoSheet to CupertinoSheetRoute - #187803

Closed
theprantadutta wants to merge 2 commits into
flutter:masterfrom
theprantadutta:fix/show-cupertino-sheet-drag-handle
Closed

theprantadutta wants to merge 2 commits into
flutter:masterfrom
theprantadutta:fix/show-cupertino-sheet-drag-handle

Conversation

@theprantadutta

Copy link
Copy Markdown
Contributor

showCupertinoSheet accepts a showDragHandle parameter but never passed it to the CupertinoSheetRoute it constructs — in either the plain branch or the useNestedNavigation branch. Since CupertinoSheetRoute.showDragHandle defaults to false, the value was silently dropped and no drag handle was rendered, even though pushing CupertinoSheetRoute directly with the same flag shows one.

This PR forwards the parameter in both branches and adds a regression test that opens a sheet through showCupertinoSheet with showDragHandle: true — once with useNestedNavigation: false and once with true — and asserts the drag handle is rendered, using the same drag-handle finder as the existing CupertinoSheetRoute.showDragHandle tests. The test fails without the fix and passes with it; the full sheet_test.dart suite (38 tests) passes.

The drag handle being invisible above stacked sheets (#187697) is a separate issue and intentionally out of scope here.

Fixes #187693

Pre-launch Checklist

showCupertinoSheet accepts a showDragHandle parameter but never passed
it to the CupertinoSheetRoute it constructs, in either the plain or the
useNestedNavigation branch. Since CupertinoSheetRoute.showDragHandle
defaults to false, the value was silently dropped and no drag handle
was rendered, even though pushing CupertinoSheetRoute directly with the
same flag shows one.

Fixes flutter#187693

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request forwards the showDragHandle parameter to the sheet route in showCupertinoSheet and adds a widget test to verify this behavior. Feedback suggests simplifying the scrollableBuilder callback in the new test by using the (_, __) shorthand for unused parameters to make the code more concise.

Comment on lines +194 to +197
scrollableBuilder:
(BuildContext context, ScrollController scrollController) {
return const CupertinoPageScaffold(child: Text('Page 2'));
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The context and scrollController parameters in scrollableBuilder are unused. We can simplify this callback using the (_, __) shorthand to make the code more concise and idiomatic.

Suggested change
scrollableBuilder:
(BuildContext context, ScrollController scrollController) {
return const CupertinoPageScaffold(child: Text('Page 2'));
},
scrollableBuilder: (_, __) => const CupertinoPageScaffold(child: Text('Page 2')),

@theprantadutta

Copy link
Copy Markdown
Contributor Author

Regarding the code freeze check: this forwards a public parameter (showDragHandle) that is currently silently ignored, scoped to two lines plus a regression test. Happy to land it here under an override if appropriate, or to port it to cupertino_ui in flutter/packages — deferring to the team on which is preferred.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages labels Jun 10, 2026
@dkwingsmt
dkwingsmt self-requested a review June 11, 2026 05:47

@dkwingsmt dkwingsmt left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix!

I'll let the CICD run. If everything goes well, I'll archive it for the freeze so that we can port it when the package is ready.

@dkwingsmt dkwingsmt added the CICD Run CI/CD label Jun 24, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 24, 2026
@dkwingsmt dkwingsmt added the CICD Run CI/CD label Jun 24, 2026

@navaronbracke navaronbracke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@Piinks Piinks added the Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. label Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I've marked this PR as not ready to port to flutter/packages yet.
We'll provide instructions to move this change over to cupertino_ui once it is ready to receive PRs. Thank you!

@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews @dkwingsmt @navaronbracke! All the functional CI is green and this is approved — the only remaining red is the Check Code Freeze gate. Could a reviewer apply the override: code freeze label so it can land, or would you prefer it wait until the freeze lifts? Happy either way — just flagging since everything else is ready.

@navaronbracke

Copy link
Copy Markdown
Contributor

I've marked this PR as not ready to port to flutter/packages yet. We'll provide instructions to move this change over to cupertino_ui once it is ready to receive PRs. Thank you!

@theprantadutta See above :)

We are currently taking inventory of all the PR's that do things for material_ui/cupertino_ui, so that we can orchestrate the move to said packages, when the code freeze is lifted.

@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks @navaronbracke, that makes total sense — no rush at all. Happy to port it over to cupertino_ui once the freeze lifts and the package is ready to receive PRs; just ping me with the instructions and I'll move it. Appreciate you keeping it on the inventory!

@dkwingsmt
dkwingsmt marked this pull request as draft July 1, 2026 20:50
@dkwingsmt dkwingsmt added the waiting for code freeze This PR is waiting for a code freeze to resolve. label Jul 1, 2026
@dkwingsmt

Copy link
Copy Markdown
Contributor

If you would like to return to this, material_ui and cupertino_ui are now accepting contributions. :)
Guidance and instructions for easily porting over can be found in #188444. Thank you for the contribution and for waiting!

@dkwingsmt dkwingsmt added Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. and removed Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. labels Sep 24, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks @dkwingsmt — ported to cupertino_ui in flutter/packages#13011 following #188444 (one small conflict with the newer hasPlatformViews argument, resolved by keeping both). Closing this one in favour of that.

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 2, 2026
…rtinoSheetRoute (#13011)

Port of flutter/flutter#187803 to `cupertino_ui`, following the process in flutter/flutter#188444. The original PR was approved by dkwingsmt and navaronbracke but couldn't land because of the Material/Cupertino code freeze.

`showCupertinoSheet` accepts a `showDragHandle` parameter and documents what it does, but never passes it to the `CupertinoSheetRoute` it builds — so setting it to `true` has no effect. This forwards it on both paths (the plain route and the nested-navigation route).

The regression test calls `showCupertinoSheet(showDragHandle: true)` and checks the drag handle is actually rendered. I checked that it fails with the forwarding removed and passes with it, in its new location under `packages/cupertino_ui/test/`.

The original commit was cherry-picked as the porting guide describes. It hit one conflict: since the copy, `main` added `hasPlatformViews: hasPlatformViews` to the same two `CupertinoSheetRoute` constructor calls. I resolved it by keeping both arguments; the bug itself is still present on `main` (`showDragHandle` is declared but never forwarded). The only new commit adds the pending changelog entry (`version: patch`).

Fixes flutter/flutter#187693

## Pre-Review Checklist

I used AI tooling while working on this, and reviewed and tested all of it myself.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages waiting for code freeze This PR is waiting for a code freeze to resolve.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

showCupertinoSheet silently ignores the showDragHandle parameter

4 participants