KV Santhosh
KV Santhosh

Reputation: 33

Flutter select text on long press

I'm pretty new to flutter and need to full fill one use case: I have one text widget. Example: Hello there, Good morning. In this text widget, when user long presses on any word say "Good", how to detect those?

I need to log into console that "user selected "Good" from this text".

How to do that in flutter text widget?

Upvotes: 2

Views: 1851

Answers (1)

Sanjayrajsinh
Sanjayrajsinh

Reputation: 17108

You need to use SelectableText() widget

Container(
    child: SelectableText(
        "Hello good morning"
    )
),

enter image description here

Upvotes: 1

Related Questions