https://kotlinlang.org logo
#compose
Title
# compose
k

Kazemihabib1996

04/03/2020, 12:19 PM
Can some one please explain why without adding the weight to TextField it occupies the whole space and icon doesn't render?
Copy code
Box(modifier = modifier.drawShadow(shape = RoundedCornerShape(5.dp), elevation = 1.dp), padding = 16.dp) {
        Row(Modifier.fillMaxWidth()) {
            TextField(value = model.text, onValueChange = { data -> model.text = data }, modifier = Modifier.weight(1f))
            Icon(Icons.Filled.Search, tint = Color.Red)
        }
    }
m

Mihai Popa

04/03/2020, 3:02 PM
TextField
is currently filling the available width. If it does not have a weight, the available width for it is the entire width/`Box`. I believe this behavior will go away. CC @Siyamed
👍 1