Skip to content

showCupertinoSheet silently ignores the showDragHandle parameter #187693

Closed
flutter/packages
#13011

Description

@art-sparrow

Steps to reproduce

  1. Call showCupertinoSheet(context: context, showDragHandle: true, scrollableBuilder: (ctx, sc) => MyContent(scrollController: sc)) from a button's onPressed.
  2. Tap the button to present the sheet.
  3. Observe the top edge of the presented sheet.

Expected results

A native-styled drag handle (small grey pill) appears at the top of the sheet, matching the behavior documented for CupertinoSheetRoute.showDragHandle and shown in the screenshots from issue #179358 / PR #179962.

Actual results

No drag handle is rendered — showDragHandle: true has no visible effect when passed through showCupertinoSheet.

Root cause: showCupertinoSheet accepts a showDragHandle parameter (default false) but never forwards it when constructing the underlying CupertinoSheetRoute, in both code branches:

https://github.com/flutter/flutter/blob/559ffa3f75/packages/flutter/lib/src/cupertino/sheet.dart#L202-L208
https://github.com/flutter/flutter/blob/559ffa3f75/packages/flutter/lib/src/cupertino/sheet.dart#L242-L251

Since CupertinoSheetRoute.showDragHandle defaults to false, the value is silently dropped and _sheetWithDragHandle (https://github.com/flutter/flutter/blob/559ffa3f75/packages/flutter/lib/src/cupertino/sheet.dart#L699-L702), which paints the handle, is never invoked.

Workaround: bypass showCupertinoSheet and push CupertinoSheetRoute directly — this correctly shows the handle, confirming the bug is isolated to the showCupertinoSheet convenience wrapper:

Navigator.of(context, rootNavigator: true).push(
  CupertinoSheetRoute<void>(
    showDragHandle: true,
    scrollableBuilder: (ctx, sc) => MyContent(scrollController: sc),
  ),
);


### Code sample


**Code sample:**
```dart
<details open><summary>Code sample</summary>

```dart
import 'package:flutter/cupertino.dart';

void main() => runApp(const CupertinoApp(home: _Demo()));

class _Demo extends StatelessWidget {
  const _Demo();

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: Center(
        child: CupertinoButton.filled(
          child: const Text('Open sheet'),
          onPressed: () => showCupertinoSheet<void>(
            context: context,
            showDragHandle: true, // <-- has no effect; no handle is shown
            scrollableBuilder: (ctx, sc) => ListView(
              controller: sc,
              children: const [
                SizedBox(height: 40),
                Center(child: Text('No drag handle visible above this text')),
              ],
            ),
          ),
        ),
      ),
    );
  }
}


### Screenshots or Video

<img width="568" height="1084" alt="Image" src="https://github.com/user-attachments/assets/da0e6af7-ab1c-450a-82c5-136a16eeb3ce" />

<img width="568" height="1084" alt="Image" src="https://github.com/user-attachments/assets/9d5ac043-e4ca-4ba7-ba53-7b5be74b9b0c" />

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]

Flutter Doctor output

Doctor output
theo@Theos-MacBook-Pro xyz % flutter doctor -v
[✓] Flutter (Channel stable, 3.44.0, on macOS 26.5.1 25F80 darwin-arm64, locale en-US) [496ms]
    • Flutter version 3.44.0 on channel stable at /Users/theo/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 559ffa3f75 (3 weeks ago), 2026-05-15 14:13:13 -0700
    • Engine revision 4c525dac5e
    • Dart version 3.12.0
    • DevTools version 2.57.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging,
      enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [3.6s]
    • Android SDK at /Users/theo/Library/Android/sdk
    • Emulator version 36.5.11.0 (build_id 15261927) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/theo/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.10+-117844308-b1163.108)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.4.1) [1,064ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17E202
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [4ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [7.1s]
    • iPhone 17 Pro (mobile) • C86719DB-BF57-4694-AA94-61AA93AC2CB5 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-26-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 26.5.1 25F80 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 148.0.7778.217

[✓] Network resources [1,017ms]
    • All expected network resources are available.

• No issues found!
theo@Theos-MacBook-Pro xyz % 

Activity

  1. added
    in triagePresently being triaged by the triage team
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: cupertino_uicupertino_ui package in flutter/packages
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-designOwned by Design Languages team
    on Jun 8, 2026
  2. mbcorona commented on Jun 8, 2026

    @mbcorona
    Member

    Hi @art-sparrow , thanks for reporting and pointing out the exact code lines, routing to the design team.

  3. theprantadutta commented on Jun 10, 2026

    @theprantadutta
    Contributor

    I can take this one if nobody's on it. The fix looks straightforward since the issue already points at the exact spots: forward showDragHandle to CupertinoSheetRoute in both branches of showCupertinoSheet in sheet.dart, plus a widget test verifying the drag handle actually appears when the parameter is set through the wrapper. Keeping #187697 (drag handle with stacked sheets) out of scope.

  4. dkwingsmt commented on Jun 10, 2026

    @dkwingsmt
    Contributor

    Thank you for the investigation!

    @theprantadutta Yes, thank you for volunteering. LMK when the PR is ready.

  5. added
    P2Important issues not at the top of the work list
    triaged-designTriaged by Design Languages team
    on Jun 10, 2026
  6. theprantadutta commented on Jun 10, 2026

    @theprantadutta
    Contributor

    PR is ready: #187803 — forwards the parameter in both branches, with a regression test covering both useNestedNavigation modes (fails without the fix). Kept #187697 out of scope as discussed.

  7. art-sparrow commented on Jun 10, 2026

    @art-sparrow
    Author

    Awesome work on the PR and channeling - @mbcorona, @theprantadutta, and @dkwingsmt.

  8. removed
    in triagePresently being triaged by the triage team
    on Jun 15, 2026
  9. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 18, 2026
  10. added a commit that references this issue on Oct 2, 2026
    4111f39
  11. github-actions commented on Oct 16, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions