ESLinkText constructor
text
text to be displayed
prefixText
a non link text to be displayed before linked text
url
the url to redirect when clicked
onTap
the function to be triggered when tapped.
Only work if URL is url
is not null
Implementation
ESLinkText(String text,
{Key? key, String prefixText = '', String? url, Function()? onTap})
: super(
key: key,
text: TextSpan(
children: [
if (prefixText != '')
TextSpan(
text: prefixText,
style: const TextStyle(color: Colors.white, fontSize: 16)),
TextSpan(
text: text,
style: const TextStyle(
color: Colors.lightBlue,
fontSize: 16,
fontWeight: FontWeight.bold),
recognizer: TapGestureRecognizer()
..onTap = () {
if (url != null) {
launch(url);
} else if (onTap != null) {
onTap();
}
},
),
],
),
);