Skip to content

ClipRSuperellipse causes app crash when wrapping WebView in iOS. #171966

@RomainHartmann

Description

@RomainHartmann

Steps to reproduce

  1. Create a Flutter app with webview_flutter dependency
  2. Wrap a WebViewWidget with ClipRSuperellipse
  3. Run the app
  4. App crashes immediately

Expected results

The WebView should render properly inside the ClipRSuperellipse container, similar to how it works with ClipRRect.

Actual results

The app crashes when ClipRSuperellipse wraps a WebView.

Code sample

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('ClipRSuperellipse + WebView Bug')),
        body: Center(
          child: SizedBox(
            width: 300,
            height: 400,
            child: ClipRSuperellipse( // This causes crash
              borderRadius: BorderRadius.circular(20),
              clipBehavior: Clip.antiAlias,
              child: WebViewWidget(
                controller: WebViewController()
                  ..loadRequest(Uri.parse('https://flutter.dev')),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
Working Alternative
// This works perfectly
ClipRRect(
  borderRadius: BorderRadius.circular(20),
  clipBehavior: Clip.antiAlias,
  child: WebViewWidget(
    controller: WebViewController()
      ..loadRequest(Uri.parse('https://flutter.dev')),
  ),
)

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.32.6, on macOS 15.5 24F74 darwin-arm64, locale fr-US) [233ms]
    • Flutter version 3.32.6 on channel stable at /Users/myuser/Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 077b4a4ce1 (2 days ago), 2025-07-08 13:31:08 -0700
    • Engine revision 72f2b18bb0
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1 051ms]
    • Android SDK at /Users/myuser/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0) [630ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.3) [9ms]
    • 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.5+-13047016-b750.29)

[✓] VS Code (version 1.95.3) [8ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.114.0

[✓] Connected device (3 available) [5,8s]
    • iPhone 16 Pro (mobile)               • 155EA5B7-6134-41C9-B90C-AAD7F7D0F1BF • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
    • macOS (desktop)                      • macos                                • darwin-arm64   •
      macOS 15.5 24F74 darwin-arm64
    • Chrome (web)                         • chrome                               • web-javascript •
      Google Chrome 137.0.7151.120

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

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: platform-viewsEmbedding Android/iOS views in Flutter appsc: fatal crashCrashes that terminate the processfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions