Skip to content

SelectableText can't be copied on web easily #100486

Closed
@qwerty108109

Description

@qwerty108109

When making a flutter web application you cannot copy the text by dragging the cursor over the text and selecting copy. You cannot select more than one word at a time. This issue has been well documented in other bug reports; they have been closed with no solution. I would expect by using the selectable text widget, it would make the text easily selectable for the end user. Which is not the case when using for websites. The problem only seems to occur when compiling flutter for the web.

Steps to Reproduce

  1. Execute flutter run on the 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: SelectableText("Selectable text"),
    );
  }
}

You'll notice how when you drag your cursor over it you cannot highlight select and copy the text like a normal website.

More examples

This widget is pretty straightforward

    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',

      home: SelectableText("Selectable text",
        cursorColor: Colors.red,
        showCursor: true,
      ),
    );
  }
}

Here is a very similar issue.

Text is not selectable by default on the web #32246

Logs

[✓] Flutter (Channel stable, 2.10.3, on Linux Mint 20.3 5.4.0-104-generic, locale en_US.UTF-8)
    • Flutter version 2.10.3 at /home/misty/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/misty/Android/Sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /home/misty/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8139111/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2020.3)
    • Android Studio at /home/misty/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7935034
    • 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.10+0-b96-7249189)

[✓] Android Studio (version 2021.1)
    • Android Studio at /home/misty/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8139111
    • Flutter plugin version 65.2.2
    • Dart plugin version 211.7808
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.65.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.36.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux Mint 20.3 5.4.0-104-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 99.0.4844.82

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!





Metadata

Metadata

Assignees

No one assigned

    Labels

    frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specificallyr: timeoutIssue is closed due to author not providing the requested details in timewaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions