flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.32k stars 27.53k forks source link

"Select All" Automatically scrolls EditableText to the end of the text field, which doesn't happen on native iOS #105731

Closed antholeole closed 2 years ago

antholeole commented 2 years ago

Steps to Reproduce

code sample:

class MyApp extends StatelessWidget {
  final textController =
      TextEditingController(text: lorem(words: 50, paragraphs: 2)); //or just manually input a lot of text, enough to overflow

  MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
          body: Center(
              child: FractionallySizedBox(
        widthFactor: 0.4,
        child: TextField(
          controller: textController,
        ),
      ))),
    );
  }
}
  1. Flutter Run
  2. Long Press on the text Field
  3. Select "Select All"

Expected results:

Should behave like native and not scroll to the end: https://user-images.githubusercontent.com/48811365/172933065-ef0a267a-f5fe-4f8a-a37d-7001ceb6fc11.gif

Actual results:

Flutter automatically scrolls to the end: https://user-images.githubusercontent.com/48811365/172933198-4aed8242-3da4-4366-b4b6-f4a3ae283cfb.gif

I'll probably just fix this along with #104945 since to fix that this one needs to be fixed, because we can calculate the correct position for the toolbar but it won't be in view anyway

danagbemava-nc commented 2 years ago

Issue is reproducible on stable and master.

recordings | flutter | reminders app | | -- | -- | |
complete sample ```dart import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { final textController = TextEditingController( text: """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas eu rutrum nibh. Duis sed purus non tortor tempor iaculis. Cras sit amet metus eget ex convallis imperdiet eget eu mauris. Suspendisse placerat nulla non justo commodo, non dictum purus tristique. Nam non congue velit, non accumsan eros. Proin commodo ultricies nisi. Aliquam id iaculis quam, scelerisque pharetra ante. Aliquam ut dui sit amet magna posuere venenatis id sit amet nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis gravida purus a blandit condimentum. Maecenas dapibus venenatis nibh. Etiam blandit augue quis ligula consectetur euismod.Quisque ultrices volutpat condimentum. Nunc egestas mollis magna ac blandit. Sed in venenatis augue, ac gravida nulla. Vivamus tortor ipsum, accumsan et ante non, egestas aliquam mi. Proin tellus nibh, viverra et tempus vitae, congue vitae lectus. Proin suscipit molestie velit, a varius neque lacinia vitae. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."); //or just manually input a lot of text, enough to overflow"""); MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( body: Center( child: FractionallySizedBox( widthFactor: 0.8, child: TextField( controller: textController, maxLines: 5, ), ), ), ), ); } } ```
flutter doctor -v ``` [✓] Flutter (Channel stable, 3.0.1, on macOS 12.3.1 21E258 darwin-arm, locale en-GB) • Flutter version 3.0.1 at /Users/nexus/dev/sdks/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision fb57da5f94 (3 weeks ago), 2022-05-19 15:50:29 -0700 • Engine revision caaafc5604 • Dart version 2.17.1 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/nexus/Library/Android/sdk • Platform android-32, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • 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 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.42.0 [✓] Connected device (3 available) • iPhone 13 (mobile) • DBB48503-41CE-4969-9043-3261726E438A • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.3.1 21E258 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61 ! Error: Nexus is not connected. Xcode will continue when Nexus is connected. (code -13) [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ``` [✓] Flutter (Channel master, 3.1.0-0.0.pre.1211, on macOS 12.3.1 21E258 darwin-arm, locale en-GB) • Flutter version 3.1.0-0.0.pre.1211 at /Users/nexus/dev/sdks/flutters • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9d46e7800f (4 hours ago), 2022-06-09 23:43:08 -0400 • Engine revision a4cdb1e232 • Dart version 2.18.0 (build 2.18.0-174.0.dev) • DevTools version 2.14.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/nexus/Library/Android/sdk • Platform android-32, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • 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 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.42.0 [✓] Connected device (3 available) • iPhone 13 (mobile) • DBB48503-41CE-4969-9043-3261726E438A • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.3.1 21E258 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61 ! Error: Nexus is not connected. Xcode will continue when Nexus is connected. (code -13) [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
antholeole commented 2 years ago

closed by https://github.com/flutter/flutter/pull/105799

github-actions[bot] commented 2 years ago

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.