Skip to content

CupertinoSheetRoute makes webview "detached" itself in background #169495

Closed
flutter/packages
#12565

Description

@TesteurManiak

Steps to reproduce

  1. Have a page with a WebViewWidget from the package webview_flutter
  2. Use showCupertinoSheet or push a CupertinoSheetRoute above this page

I've also tested with flutter_inappwebview and the behavior is the same, this makes me think that it might be an issue with PlatformViews in general.

Expected results

The webview should perform the transition alongside the page it is attached to.

Actual results

The webview looks "detached" from the rest of the page. Like it is stacked on top.

Code sample

Code sample
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebviewSamplePage extends StatefulWidget {
  const WebviewSamplePage({super.key});

  @override
  State<WebviewSamplePage> createState() => _WebviewSamplePageState();
}

class _WebviewSamplePageState extends State<WebviewSamplePage> {
  late final WebViewController controller;

  @override
  void initState() {
    super.initState();

    controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadRequest(Uri.parse('https://flutter.dev'));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.green,
      appBar: AppBar(
        title: const Text('Webview Sample'),
        actions: [
          IconButton(
            onPressed: () {
              showCupertinoSheet(
                context: context,
                enableDrag: true,
                pageBuilder: (_) =>
                    CupertinoPageScaffold(child: const Placeholder()),
              );
            },
            icon: Icon(Icons.exit_to_app),
          ),
        ],
      ),
      body: WebViewWidget(controller: controller),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Enregistrement.de.l.ecran.2025-05-27.a.10.28.45.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.0, on macOS 15.4.1 24E263 darwin-arm64, locale fr-FR) [525ms]
    • Flutter version 3.32.0 on channel stable at /Users/guigui/fvm/versions/3.32.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be698c48a6 (8 days ago), 2025-05-19 12:59:14 -0700
    • Engine revision 1881800949
    • Dart version 3.8.0
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [1 583ms]
    • Android SDK at /Users/guigui/Library/Android/sdk
    • Platform android-35, build-tools 35.0.1
    • 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.6+-13368085-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [1 961ms]
    • Xcode at /Applications/Xcode-16.2.0.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.3) [8ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)

[✓] VS Code (version 1.100.2) [7ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.110.0

[✓] Connected device (3 available) [6,2s]
    • iPhone SE (3rd generation) (mobile) • 229F8E7E-A4F2-4F72-86A2-2D055D7D707E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 137.0.7151.41

[✓] Network resources [228ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. tirth-patel-nc commented on May 27, 2025

    @tirth-patel-nc
    Member

    Triage Report

    I was able to reproduce the issue using the provided code sample on the stable (3.29.3), and stable (3.32.0) channels on iOS and macOS. On Android it is working fine.

    Screen.Recording.2025-05-27.at.5.14.02.PM.mov

    I tried using google_maps_flutter, and I can see the similar issue. It seems like general platform view issue and not specific to a package.

    Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-05-28.at.11.32.04.mp4

    On master (3.33.0-1.0.pre.228), it is reproducible on macOS and not reproducible on Android, but it crashes on iOS. Crash happens on-click of IconButton in AppBar's action.

    crash.txt

    Screen.Recording.2025-05-27.at.5.49.37.PM.mov

    stable (3.32.0) - flutter doctor -v
    [✓] Flutter (Channel stable, 3.32.0, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [446ms]
        • Flutter version 3.32.0 on channel stable at /Users/tirthpatel/Development/flutter_stable_latest/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision be698c48a6 (34 hours ago), 2025-05-19 12:59:14 -0700
        • Engine revision 1881800949
        • Dart version 3.8.0
        • DevTools version 2.45.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [827ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Platform android-36, build-tools 36.0.0
        • 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.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [448ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    master (3.33.0-1.0.pre.228) - flutter doctor -v
    [✓] Flutter (Channel master, 3.33.0-1.0.pre.228, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [4.1s]
        • Flutter version 3.33.0-1.0.pre.228 on channel master at /Users/tirthpatel/Development/flutter_master/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 4e75d56bda (6 hours ago), 2025-05-27 07:25:42 +0800
        • Engine revision 4e75d56bda
        • Dart version 3.9.0 (build 3.9.0-172.0.dev)
        • DevTools version 2.46.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [849ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
        • Platform android-36, build-tools 36.0.0
        • 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.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [605ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
  2. added
    platform-iosiOS applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-macosBuilding on or for macOS specifically
    packageflutter/packages repository. See also p: 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
    fyi-ecosystemFor the attention of Ecosystem team
    and removed
    in triagePresently being triaged by the triage team
    team-designOwned by Design Languages team
    on May 27, 2025
  3. 14 remaining items

  4. added
    ⏳Bot is counting down the days until it unassigns the issue
    on Oct 10, 2025
  5. flutter-triage-bot commented on Oct 10, 2025

    @flutter-triage-bot

    This issue is assigned to @hellohuanlin but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

  6. flutter-triage-bot commented on Dec 25, 2025

    @flutter-triage-bot

    This issue was assigned to @hellohuanlin but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

  7. removed
    ⏳Bot is counting down the days until it unassigns the issue
    on Dec 25, 2025
  8. laishere commented on Feb 26, 2026

    @laishere

    Working on a PR, and here's the workaround https://gist.github.com/laishere/9cdfc9f598448ebd9a5c8a4f593cb760

    It's based on https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/cupertino/sheet.dart

    Save it to your project then:

    showCustomCupertinoSheet(
      context: context,
      enableFilter: false, // disable image filter for platform view (might not needed for android)
      builder: (context) => SheetContent(),
    );
  9. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 18, 2026
  10. github-actions commented on Sep 23, 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.

  11. locked as resolved and limited conversation to collaborators on Sep 23, 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 lista: platform-viewsEmbedding Android/iOS views in Flutter appsfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has 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.platform-iosiOS applications specificallyplatform-macosBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions