I have code with implementation of ClickableText with underline text.
Row(
modifier = Modifier
.fillMaxWidth()
.height(IntrinsicSize.Min)
.padding(5.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "From",
fontWeight = FontWeight.Black
)
ClickableAddress(emailAddress = addressesFrom)
}
@Composable
fun ClickableAddress(
emailAddress: Array<EmailAddress?>
) {
for (address in emailAddress) {
address?.let { CreateUnderlineEmail(it) }?.let {
ClickableText(
text = it,
onClick = {
/*TODO*/
}
)
}
}
}
@Composable
private fun CreateUnderlineEmail(address: EmailAddress): AnnotatedString {
return buildAnnotatedString {
if (address != null) {
append(address.name + " <")
withStyle(
style = SpanStyle(
textDecoration = TextDecoration.Underline
),
) {
append(address.address)
}
append("> ")
}
}
}
How can I implement Text filed with list of EmailAddress and every email must be clickable?
My code creates ClickableText not like row, but as separate fields.