I want if Someone long press on ListTile, than copy the Text..
Here is snippet of my code,
Card(
margin: EdgeInsets.symmetric(horizontal: 25.0, vertical: 10.0),
child: ListTile(
leading: Icon(
Icons.call,
color: Colors.teal,
size: 30.0,
),
title: Text(
'+11 11111 11111',
style: TextStyle(
color: Colors.black,
fontFamily: 'EncodeSansExpanded',
fontSize: 15.0,
),
),
)
),
I want to do like, anyone long-press on it than copy the number in above code..
4
Answers
you could do something like this:
first declare the text you are trying to copy as a variable:
then wrap you code in a GestureDetector Widget a use the onLongPress method and us import flutter services to use Clipboard.setdata like this
Try below answer when you longPressed on
ListTile
it will copy the your data. Read more about ClipboardImport below package:
UI:
Wrap you card with "GestureDetector" then pass the text to the Clipboard.setData.
Here is the an example.
You can embed
Card
inSelectionArea
Like this: