Skip to content

util-kotlin 2.5.4

Choose a tag to compare

@sam-chen-dev sam-chen-dev released this 19 May 02:19
· 19 commits to main since this release

Update:

  • Added colorFilter param for Image():
fun Image(
    resId: Int,
    contentDescription: String,
    contentScale: ContentScale,
    modifier: Modifier = Modifier,
    colorFilter: ColorFilter? = null
) {
    Image(
        painterResource(resId),
        contentDescription,
        contentScale = contentScale,
        modifier = modifier,
        colorFilter = colorFilter
    )
}
  • Refactor AnnotatedStringExtensions, removed @Composable:
fun AnnotatedString.Builder.append(text: String, url: String) = withLink(LinkAnnotation.Url(url)) {
    append(text)
}

fun AnnotatedString.Builder.append(text: String, color: Color) = withStyle(SpanStyle(color)) {
    append(text)
}

fun AnnotatedString.Builder.append(text: String, color: Color, onCLick: () -> Unit) = withLink(
    LinkAnnotation.Clickable(
        tag = text,
        styles = TextLinkStyles(SpanStyle(color)),
        linkInteractionListener = { onCLick() }
    )
) {
    append(text)
}