There is a unidentifiable top padding in `Outlined...
# compose
l
There is a unidentifiable top padding in
OutlinedTextField
. Is it intended?
Copy code
@Preview
@Composable
fun OutLinedTextPreview() {
    Box {
        var text by rememberSaveable { mutableStateOf("") }

        OutlinedTextField(
            value = text,
            onValueChange = { text = it },
            label = { Text("Label") }
        )
    }
}
d
The label needs room to be shown at the top. Without it I think it would suffer from sudden height changes. If you focus the field on the device you will see why.
l
Hmm makes sense, good hint. Do you know if it can be disabled?
d
No, it is intrinsic.
Or perhaps it is there because you have a label at all. I wonder if it goes away if there is no label composable. 🤔
I wonder if it is equal to half the label height.
Copy code
/*
This padding is used to allow label not overlap with the content above it. This 8.dp will work
for default cases when developers do not override the label's font size. If they do, they will
need to add additional padding themselves
*/
private val OutlinedTextFieldTopPadding = 8.dp
👌 1
If you override the default labels text size you might be able to make it go away.
Or not because it says that additional padding would be needed.
And I can’t see a condition anywhere in the code that removes it.
l
ok thanks a lot for taking the time to figure it out. I'm fine with this, it seems legit though