Skip to content

[iOS][PlatformView] Conflict between Flutter ListView scrolling and PlatformView #162071

@delfme

Description

@delfme

Steps to reproduce

This example highlights a conflict between Flutter's scrolling and the native platform view's TextView scrolling and text selection. Specifically, text selection in the TextView only works when ListView scrolling is disabled using physics: NeverScrollableScrollPhysics(). This limitation affects the usability of TextView and could also impact other types of platform views.
Note: This issue occurs only on iOS.

Expected results

Users should be able to select text even when the TextView is inside a scrollable widget.

Actual results

User cannot select text when TextView is inside a scrollable Widget and scrolling is enabled.

Code sample

flutter_native_text_view_sample_main.zip

Code sample

Run this ready code:
Screen has 3 Texts elements:

  • the first one is flutter widget
  • the other two are platform views.
    Try to select text, it works with flutter widget but doesn't work with platform views. If scrolling is disable, text selection works also with platform views. After testing we think there is a conflict at low level.
    Sample here:

Screenshots or Video

Screenshots / Video demonstration
  • Flutter's SelectableText: Text selection works as expected.
  • Native Platform View: Text selection is hindered by scrolling functionality.
videozip_1349.MP4

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.24.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-IT)
    ! Flutter version 3.24.5 on channel [user-branch] at /Users/delfme/Development/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources


Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsf: scrollingViewports, list views, slivers, etc.found in release: 3.27Found to occur in 3.27found in release: 3.29Found to occur in 3.29frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications 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