mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-06-28 11:51:05 +02:00
No need to remember this.
This commit is contained in:
parent
aa909184fd
commit
dc73aec334
@ -12,17 +12,18 @@ import androidx.compose.ui.text.AnnotatedString
|
|||||||
fun ClickableUrl(urlText: String, url: String) {
|
fun ClickableUrl(urlText: String, url: String) {
|
||||||
val uri = LocalUriHandler.current
|
val uri = LocalUriHandler.current
|
||||||
|
|
||||||
val doubleCheckedUrl = remember(url) {
|
|
||||||
if (url.contains("://")) url else "https://$url"
|
|
||||||
}
|
|
||||||
|
|
||||||
val text = remember(urlText) {
|
val text = remember(urlText) {
|
||||||
AnnotatedString(urlText)
|
AnnotatedString(urlText)
|
||||||
}
|
}
|
||||||
|
|
||||||
ClickableText(
|
ClickableText(
|
||||||
text = text,
|
text = text,
|
||||||
onClick = { runCatching { uri.openUri(doubleCheckedUrl) } },
|
onClick = {
|
||||||
|
runCatching {
|
||||||
|
val doubleCheckedUrl = if (url.contains("://")) url else "https://$url"
|
||||||
|
uri.openUri(doubleCheckedUrl)
|
||||||
|
}
|
||||||
|
},
|
||||||
style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.primary)
|
style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.primary)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user