这是indexloc提供的服务,不要输入任何密码
Skip to content

Scroll behaviour in Flutter view within an iOS share extension is broken #164670

@JakeThomson

Description

@JakeThomson

After following the flutter docs on how to use flutter views in an iOS share extension, I have come across an issue which I have found impossible to get around.

It seems that there is no way to prevent the share sheet from consuming drag touch events, essentially making Flutter an unusable option if you are expecting your share extension to require some form of scrolling - which is a huge shame as developers are now forced to build and maintain an identical theme in swift as well as a number of components that exist in the flutter app.

Steps to reproduce

  1. Set up a share extension for a blank project
  2. Set the share extension content as a list view with x rows
  3. Run flutter run and then open an external app (like safari) to trigger share extension
  4. Attempt to scroll flutter view

Expected results

The flutter view should scroll

Screen.Recording.2025-03-06.at.00.58.07.mov

Actual results

The flutter view sometimes scrolls a few pixels, but the share sheet always consumes the drag event

Screen.Recording.2025-03-06.at.00.58.31.mov

Code sample

Code sample

https://github.com/JakeThomson/share_sheet_test

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.29.0, on macOS 14.0 23A344 darwin-arm64, locale en-GB) [1,895ms]
    • Flutter version 3.29.0 on channel stable at /Users/jakethomson/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (3 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [3.5s]
    • Android SDK at /Users/jakethomson/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Users/jakethomson/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary
      8.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.4+-12422083-b607.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4) [1,707ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.2.2) [110ms]
    • Android Studio at /Users/jakethomson/Applications/Android Studio Ladybug Feature Drop 2024.2.2
      Canary 8.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.4+-12422083-b607.1)

[✓] Android Studio (version 2024.1.2) [108ms]
    • Android Studio at /Users/jakethomson/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 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Android Studio (version 2022.3) [108ms]
    • Android Studio at /Users/jakethomson/Applications/Android Studio Giraffe 2022.3.1 Patch
      2.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 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Community Edition (version 2023.3.1) [108ms]
    • IntelliJ at /Users/jakethomson/Applications/IntelliJ IDEA Community Edition.app
    • Flutter plugin version 77.0.1
    • Dart plugin version 233.11799.172

[✓] VS Code (version 1.96.4) [14ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.104.0

[✓] Connected device (5 available) [7.5s]
    • iPhone 15 Pro Max (mobile)        • 9141863F-10C8-495D-AE56-1589E7B11E94 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                   • macos                                • darwin-arm64   • macOS
      14.0 23A344 darwin-arm64
    • Mac Designed for iPad (desktop)   • mac-designed-for-ipad                • darwin         • macOS
      14.0 23A344 darwin-arm64
    • Chrome (web)                      • chrome                               • web-javascript • Google
      Chrome 133.0.6943.142

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: solvedIssue is closed as solvedteam-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