LinkTextSpan constructor
LinkTextSpan({
- TextStyle? style,
- required Uri url,
- String? text,
- LinkTapHandler? onLinkTap,
- List<
InlineSpan> ? children,
Implementation
LinkTextSpan(
{TextStyle? style,
required this.url,
String? text,
this.onLinkTap,
List<InlineSpan>? children})
: super(
style: style,
text: text ?? '',
children: children ?? <InlineSpan>[],
recognizer: TapGestureRecognizer()
..onTap = () async {
if (onLinkTap != null) {
onLinkTap(url);
return;
}
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
throw 'Could not launch $url';
}
},
) {
_fixRecognizer(this, recognizer!);
}