Open
Description
First of all, I want to say thanks for your great framework, Flutter is awesome! I really enjoy using it. However there is one thing that needs to be fixed.
Steps to Reproduce:
- Create a ListView or ListView.builder with a lot of items and long text at the bottom
- Scroll it down and try to select all the text in the bottom, starting with beginning
Expected results:
Text is being selected correctly and you can drag the handle to select it all.
Actual results:
List starts to scroll. Sometimes selection is being cleared and you have to select it again, sometimes selection handles doesnt work. Users leave 1 star reviews because of that:(
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const TestPage(),
);
}
}
class TestPage extends StatelessWidget {
const TestPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
const text = """
START THE SELECTION HERE
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
This widget is the home page of your application. It is stateful, meaning
that it has a State object (defined below) that contains fields that affect
how it looks.
This class is the configuration for the state. It holds the values (in this
case the title) provided by the parent (in this case the App widget) and
used by the build method of the State. Fields in a Widget subclass are
always marked final.
END THE SELECTION HERE
""";
const itemCount = 500;
return Scaffold(
body: Scrollbar(
child: ListView.builder(
itemCount: itemCount,
itemBuilder: (context, index) {
if (index < itemCount - 1) {
return const Text("Example\n simple\n text");
}
return const SelectableText(text);
},
),
),
);
}
}
Logs
Analyzing selectable_text...
No issues found! (ran in 1.3s)
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.3 21E230 darwin-arm, locale en-RU)
• Flutter version 3.0.5 at /Users/me/Work/bin/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (7 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/me/Library/Android/sdk
• Platform android-33, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment Homebrew (build 18.0.2+0)
• 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
[✓] Android Studio (version 4.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 Homebrew (build 18.0.2+0)
[✓] VS Code (version 1.70.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (3 available)
• 13 (mobile) • 00008110-001838C23C82801E • ios • iOS 15.4 19E241
• iPhone 13 mini (mobile) • 66E8BECB-AF2F-438E-A1B6-25A50EE7B61E • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.3 21E230
darwin-arm
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listEntering text in a text field or keyboard related problemsflutter/packages/flutter/material repository.Viewports, list views, slivers, etc.Found to occur in 3.3Found to occur in 3.4flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onOwned by Design Languages teamTriaged by Design Languages team