Skip to content

[flutter_markdown]: rendered text is not selectable #91524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrewschmidt-a opened this issue Oct 8, 2021 · 3 comments
Closed

[flutter_markdown]: rendered text is not selectable #91524

andrewschmidt-a opened this issue Oct 8, 2021 · 3 comments
Labels
found in release: 2.6 Found to occur in 2.6 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: flutter_markdown flutter/packages flutter_markdown P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@andrewschmidt-a
Copy link

https://googleflutter.com/flutter-selectabletext/

Why not make the Text selectable by default. This seems to make sense for content.

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Oct 11, 2021
@darshankawar
Copy link
Member

Using below code sample, the text doesn't seem to be selectable:

code sample


import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MinimalMarkdownDemo(),
    );
  }
}

const String _data = '''
# Minimal Markdown Test
---
This is a simple Markdown test. Provide a text string with Markdown tags
to the Markdown widget and it will display the formatted output in a scrollable
widget.
## Section 1
Maecenas eget **arcu egestas**, mollis ex vitae, posuere magna. Nunc eget
 aliquam tortor. Vestibulum porta sodales efficitur. Mauris interdum turpis
 eget est condimentum, vitae porttitor diam ornare.
### Subsection A
Sed et massa finibus, blandit massa vel, vulputate velit. Vestibulum vitae
venenatis libero. ***Curabitur sem lectus, feugiat eu justo in, eleifend
accumsan ante.*** Sed a fermentum elit. Curabitur sodales metus id mi ornare,
in ullamcorper magna congue.
''';

class MinimalMarkdownDemo extends StatelessWidget {
  const MinimalMarkdownDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Markdown Demo')),
      body: MarkdownBody(
        styleSheet: MarkdownStyleSheet(
          h1Align: WrapAlignment.center,
          h2Align: WrapAlignment.end,
        ),
        data: _data,
      ),
    );
  }
}




@darshankawar darshankawar added p: first party p: flutter_markdown flutter/packages flutter_markdown package flutter/packages repository. See also p: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 2.6 Found to occur in 2.6 and removed in triage Presently being triaged by the triage team labels Oct 11, 2021
@darshankawar darshankawar changed the title Mardown_futter: rendered text is not selectable [flutter_markdown]: rendered text is not selectable Oct 11, 2021
@darshankawar
Copy link
Member

@andrewschmidt-a
If you set selectable: true inside MarkdownBody, it allows you to select the text. Can you try that once and see if it serves your case ?

@stuartmorgan-g stuartmorgan-g added the P3 Issues that are less important to the Flutter project label Oct 12, 2021
@flutter-triage-bot flutter-triage-bot bot added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 8, 2023
@tirth-patel-nc
Copy link
Member

tirth-patel-nc commented May 16, 2025

Triage Report

I was not able to reproduce the issue using the provided code sample on either the stable (3.29.3) or master (3.33.0-1.0.pre.107) channels.

You need to set selectable: true for MarkdownBody.

flutter_markdown - 0.7.7+1

Screen.Recording.2025-05-16.at.10.57.51.PM.mov

❗ However on iOS (master) I noticed a different issue. I'll file a new issue separately.

Master (iOS) Stable (iOS)
master.mp4
stable.mp4

This new issue doesn't happen for MacOS, Web or Android.

Code Sample
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: MinimalMarkdownDemo(),
    );
  }
}

const String _data = '''
# Minimal Markdown Test
---
This is a simple Markdown test. Provide a text string with Markdown tags
to the Markdown widget and it will display the formatted output in a scrollable
widget.
## Section 1
Maecenas eget **arcu egestas**, mollis ex vitae, posuere magna. Nunc eget
 aliquam tortor. Vestibulum porta sodales efficitur. Mauris interdum turpis
 eget est condimentum, vitae porttitor diam ornare.
### Subsection A
Sed et massa finibus, blandit massa vel, vulputate velit. Vestibulum vitae
venenatis libero. ***Curabitur sem lectus, feugiat eu justo in, eleifend
accumsan ante.*** Sed a fermentum elit. Curabitur sodales metus id mi ornare,
in ullamcorper magna congue.
''';

class MinimalMarkdownDemo extends StatelessWidget {
  const MinimalMarkdownDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Markdown Demo')),
      body: MarkdownBody(
        selectable: true,
        styleSheet: MarkdownStyleSheet(
          h1Align: WrapAlignment.center,
          h2Align: WrapAlignment.end,
        ),
        data: _data,
      ),
    );
  }
}
stable (3.29.3) - flutter doctor -v
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale
    en-IN) [970ms]
    • Flutter version 3.29.3 on channel stable at
      /Users/tirthpatel/Development/flutter_stable/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000
    • Engine revision cf56914b32
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    [855ms]
    • Android SDK at /Users/tirthpatel/Library/Android/sdk
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on
      this machine.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [556ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [9ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [9ms]
    • 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 21.0.6+-13355223-b631.42)

[✓] VS Code (version 1.99.3) [8ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available) [5.5s]
    • macOS (desktop)                 • macos                 • darwin-arm64   •
      macOS 15.4.1 24E263 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         •
      macOS 15.4.1 24E263 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript •
      Google Chrome 135.0.7049.115

[✓] Network resources [559ms]
    • All expected network resources are available.

• No issues found!
master (3.33.0-1.0.pre.107) - flutter doctor -v
[✓] Flutter (Channel master, 3.33.0-1.0.pre.107, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [1,482ms]
    • Flutter version 3.33.0-1.0.pre.107 on channel master at /Users/tirthpatel/Development/flutter_master/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8ae7b522dc (43 minutes ago), 2025-05-16 10:07:53 -0700
    • Engine revision 8ae7b522dc
    • Dart version 3.9.0 (build 3.9.0-131.0.dev)
    • DevTools version 2.46.0

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [781ms]
    • Android SDK at /Users/tirthpatel/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [461ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [7ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [7ms]
    • 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 21.0.6+-13355223-b631.42)

[✓] VS Code (version 1.100.2) [6ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.110.0

[✓] Connected device (3 available) [5.6s]
    • iPhone 16 Plus (mobile) • B19185FD-0093-4E49-B587-16642A3EC7D3 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-4 (simulator)
    • macOS (desktop)         • macos                                • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 136.0.7103.114

[✓] Network resources [477ms]
    • All expected network resources are available.

• No issues found!

I'm closing this issue as the original problem is not reproducible.

@tirth-patel-nc tirth-patel-nc added r: fixed Issue is closed as already fixed in a newer version and removed r: fixed Issue is closed as already fixed in a newer version labels May 16, 2025
@tirth-patel-nc tirth-patel-nc added the r: fixed Issue is closed as already fixed in a newer version label May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
found in release: 2.6 Found to occur in 2.6 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: flutter_markdown flutter/packages flutter_markdown P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy