pub fn ClickableText(
text: AnnotatedString,
modifier: Modifier,
style: TextStyle,
on_click: impl Fn(usize) + 'static,
) -> NodeIdExpand description
Displays an AnnotatedString and calls on_click with the byte offset of the character
under the pointer at the time of the click.
Callers typically use the offset to query string annotations:
ⓘ
ClickableText(
text.clone(),
Modifier::empty(),
TextStyle::default(),
|offset| {
for ann in text.get_string_annotations("URL", offset, offset + 1) {
uri_handler.open_uri(&ann.item.annotation).ok();
}
},
);§JC parity
@Composable
fun ClickableText(
text: AnnotatedString,
modifier: Modifier = Modifier,
style: TextStyle = TextStyle.Default,
onClick: (Int) -> Unit,
)