Hyperlink constructor
Hyperlink(
- dynamic node,
- dynamic next, {
- Color? color,
Implementation
Hyperlink(node, next, {Color? color})
: assert(node['data'] != null),
assert(node['data']['uri'] != null), // ensure uri exists for hyperlink
assert(node['data']['uri'] != ''),
super(
text: node['value'],
style: MARKS
.getMarksTextStyles(
TextNode(node).marks,
singletonRenderers.renderMark,
)
.copyWith(
color: color ?? Colors.blue,
decoration: TextDecoration.underline,
),
children: next(node['content']),
recognizer: TapGestureRecognizer()
..onTap = () async {
// NOTE: Defaults to Url_Launcher, but component can be overridden
final uri = Uri.tryParse(node['data']['uri']);
if (uri != null && await canLaunchUrl(uri)) {
await launchUrl(uri);
}
},
);