Closed maxmitz closed 2 weeks ago
The issue has something to do with the field implementing gestures for the text selection.
If you replace the field with a Gesture detector and pass onHorizontalDragUpdate
you get the same behavior you get on iOS (but you get it on both platforms). (It doesn't happen if you define only onTap)
I believe that the field widget implements some platform-specific logic that defines (only for iOS) the dragging behavior for the RawGestureDetector underneath.
My results by running gesture arena:
Android
I/flutter ( 6180): Gesture arena 1 ❙ ★ Opening new gesture arena.
I/flutter ( 6180): Gesture arena 1 ❙ Adding: LongPressGestureRecognizer#c7fd1(debugOwner: _TextSelectionGestureDetectorState#74587, state: ready)
I/flutter ( 6180): Gesture arena 1 ❙ Adding: TapAndHorizontalDragGestureRecognizer#bc5ef(debugOwner: _TextSelectionGestureDetectorState#74587)
I/flutter ( 6180): Gesture arena 1 ❙ Adding: HorizontalDragGestureRecognizer#bb172(debugOwner: GestureDetector, start behavior: start)
I/flutter ( 6180): Gesture arena 1 ❙ Adding: VerticalDragGestureRecognizer#ba151(start behavior: start)
I/flutter ( 6180): Gesture arena 1 ❙ Closing with 4 members.
I/flutter ( 6180): Gesture arena 1 ❙ Accepting: HorizontalDragGestureRecognizer#bb172(debugOwner: GestureDetector, start behavior: start)
I/flutter ( 6180): Gesture arena 1 ❙ Self-declared winner: HorizontalDragGestureRecognizer#bb172(debugOwner: GestureDetector, start behavior: start)
iOS
flutter: Gesture arena 13 ❙ ★ Opening new gesture arena.
flutter: Gesture arena 13 ❙ Adding: LongPressGestureRecognizer#8310a(debugOwner: _TextSelectionGestureDetectorState#bcacb, state: ready)
flutter: Gesture arena 13 ❙ Adding: TapAndHorizontalDragGestureRecognizer#5e5b9(debugOwner: _TextSelectionGestureDetectorState#bcacb)
flutter: Gesture arena 13 ❙ Adding: HorizontalDragGestureRecognizer#e568a(debugOwner: GestureDetector, start behavior: start)
flutter: Gesture arena 13 ❙ Adding: VerticalDragGestureRecognizer#fccbd(start behavior: start)
flutter: Gesture arena 13 ❙ Closing with 4 members.
flutter: Gesture arena 13 ❙ Rejecting: LongPressGestureRecognizer#8310a(debugOwner: _TextSelectionGestureDetectorState#bcacb, state: possible)
flutter: Gesture arena 13 ❙ Accepting: TapAndHorizontalDragGestureRecognizer#5e5b9(debugOwner: _TextSelectionGestureDetectorState#bcacb)
flutter: Gesture arena 13 ❙ Self-declared winner: TapAndHorizontalDragGestureRecognizer#5e5b9(debugOwner: _TextSelectionGestureDetectorState#bcacb)
Thanks for the report. I was able to see the same behavior as observed on both platforms. The same is noticed using the official code sample (by replacing Text
with TextField
).
I looked at native iOS app (Reminders) and observed that the swiping from center area which is clickable, is possible.
https://github.com/flutter/flutter/assets/67046386/2951a140-7958-4727-9f72-a9489603efe2
If the TextField takes up the entire Dismissible, then it will handle the gesture. This is also not true for iOS.
Updated the code from above link and running on both platform still gives the same behavior as reported.
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.
Steps to reproduce
Expected results
The behavior should be the same on iOS and Android. In my opinion, it should on both platforms be possible to dismiss by sliding the TextFormField.
If the TextField takes up the entire Dismissible, then it will handle the gesture. This is also not true for iOS.
Actual results
On Android you can dismiss an item by touching the red SizedBox part but also the TextFormField part. On iOS you can dismiss an item only by touching the red SizedBox part but not the TextFormField part.
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override StateScreenshots or Video
Screenshots / Video demonstration
https://github.com/flutter/flutter/assets/72440045/f13c2d0b-d510-48a0-8f3a-cbe597ac52cd https://github.com/flutter/flutter/assets/72440045/2b4c3ae1-8b4c-42c0-9407-3d3ca6e2c95aFlutter Doctor output
Doctor output
```console Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.5, on macOS 14.0 23A344 darwin-arm64, locale de-DE) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [✓] Xcode - develop for iOS and macOS (Xcode 15.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.85.1) [✓] Connected device (5 available) [✓] Network resources • No issues found!```