https://kotlinlang.org logo
#compose-android
Title
# compose-android
i

IsaacMart

11/16/2023, 10:09 AM
Hello devs. I am new to jetpack compose canvas drawing. I need help in modifying my image to fill the rest of the width on the right.
Copy code
Canvas(modifier = Modifier
        .fillMaxWidth()
        .height(110.dp)
        .clip(shape = RoundedCornerShape(MEDIUM_PADDING))
    ) {
        
        drawImage(
            image = dogImage,
            topLeft = Offset(x = size.width * 0.6f, 0f)
        )
        val path = Path().apply {
            moveTo(x = 0f, y = 0f)
            lineTo(x = size.width * 0.7f, y = 0f)
            lineTo(x = size.width * 0.6f, y = size.height)
            lineTo(x = 0f, y = size.height)
            close()
        }
        drawPath(
            path = path,
            color = DarkGrey,
        )
        drawText(
            textMeasurer,
            skill.skill_name,
            topLeft = Offset(x = 40F, y = (size.height / 2) - 70F),
            style = TextStyle(
                fontSize = 17.sp,
                color = Color.White,
                fontStyle = FontStyle.Normal
            )
        )
        val path2 = Path().apply {
            moveTo(x = size.width * 0.7f, y = 0f)
            lineTo(x = size.width * 0.8f, y = 0f)
            lineTo(x = size.width * 0.7f, y = size.height)
            lineTo(x = size.width * 0.6f, y = size.height)
            close()
        }
        drawPath(
            path = path2,
            color = DarkGrey,
            alpha = 0.2f
        )

    }
🧵 1