lazyvgrid - How to create a dynamic background design using BoxWithConstraints - Stack Overflow

admin2025-04-17  3

I want to create this UI:

And this is my feature composable function to do so:

@Composable
fun FeatureItem(
    Feature: feature
){
    BoxWithConstraints(
        modifier = Modifier
            .padding(7.5.dp)
            .aspectRatio(1f)
            .clip(RoundedCornerShape(10.dp))
            .background(Feature.darkColor)
    ) {
        val width = maxWidth
        val height = maxHeight
        //mediumcolorPoint
        val mediumcolorPoint1= Offset(0f,height*0.3f)
        val mediumcolorPoint2= Offset(width*0.1f,height*0.35f)
        val mediumcolorPoint3= Offset(width*0.4f,height*0.05f)
        val mediumcolorPoint4= Offset(width*0.75f,height*0.7f)
        val mediumcolorPoint5= Offset(width*1.4f,-height.toFloat())
    }

}
转载请注明原文地址:http://anycun.com/QandA/1744834105a88265.html