hyperlinkStyle
fun hyperlinkStyle(color: HyperlinkColor = HyperlinkColor.Default, active: Boolean): SpanStyle(source)
HyperlinkStyle method is meant to be style text as an Skapa Hyperlink component in those cases the raw component is not enough by itself
Return
Parameters
color
HyperlinkColor different set of colors for the text
active
indicates if the link has been clicked
Samples
var active by rememberSaveable { mutableStateOf(false) }
val annotatedText = buildAnnotatedString {
append("I have read the ")
// We attach this *URL* annotation to the following content
// until `pop()` is called
pushStringAnnotation(
tag = "link",
annotation = "terms and conditions"
)
withStyle(
hyperlinkStyle(active = active, color = HyperlinkColor.Grey)
) {
append("terms and conditions")
}
pop()
}
var checked by remember { mutableStateOf(false) }
SkapaTheme2(isSystemInDarkTheme()) {
Row(horizontalArrangement = Arrangement.spacedBy(SkapaSpacing.space100)) {
Checkbox(
checked = checked,
onCheckedChange = { checked = !checked }
)
BasicText(
text = annotatedText,
style = LocalTextStyle.current,
modifier = Modifier.clickable {
active = true
}
)
}
}Content copied to clipboard