flutter / flutter/flutter

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

Open
#162,071 7 comments 0 reactions 0 assignees View on GitHub
a: platform-views f: scrolling found in release: 3.27 found in release: 3.29 framework has reproducible steps P2 platform-ios team-ios triaged-ios
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### 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](https://github.com/user-attachments/files/18545585/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.

https://github.com/user-attachments/assets/f7abf303-97b7-4d74-89cc-5ce17426dcae

### Flutter Doctor output

Doctor output

```Doctor summary (to see all details, run flutter doctor -v):
[!] 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

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.