In this video they say you can use a Gesture recognizers in order to create a clickable link in your TextSpan, but I found no examples in the RichText official documentation and in general on internet. Can someone please explain me how to do that?
Asked
Active
Viewed 1,377 times
1 Answers
5
Basically is something like this
RichText(
text: TextSpan(
children: [
TextSpan(text: 'Hello'),
TextSpan(
text: 'World',
recognizer: TapGestureRecognizer()
..onTap = () async {
//Code to launch your URL
}
)
]
)
);
You can use the URL launcher to manage the links, that goes like this:
const url = 'https://flutter.dev';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}

Frank
- 789
- 4
- 19