Skip to content

How can we use with Jetpack Compose Image? #19

@orcuns

Description

@orcuns
@Composable
fun Button(style: ButtonStyle = ButtonStyle()) {
    val colorFilter = style.centerImageTintColorRes.let { ColorFilter.tint(colorRes(id = it)) }
    val imageView = ImageView(LocalContext.current)
    val vector = VectorChildFinder(LocalContext.current, style.centerImageRes, imageView)
    val path1: VectorDrawableCompat.VFullPath = vector.findPathByName("path1")
    path1.fillColor = style.centerImageTintColorRes

    imageView.drawable.toBitmap().asImageBitmap()

      Image(
            painter = painterResource(id = style.centerImageRes),
            colorFilter = colorFilter,
            contentDescription = "", modifier = Modifier.size(54.dp)
        )
}

I can't make it with Jetpack compose unfortunately. Maybe someone else knows a way to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions