Nthily
05/23/2024, 9:51 AMimePadding doesn't seem to pop up with the TextField(It will have extra padding underneath) 🤔🧵.Nthily
05/23/2024, 9:53 AMColumn {
Box(
Modifier.fillMaxWidth().height(56.dp).background(Color.Gray)
) {
Text("Top bar")
}
LazyColumn(
modifier = Modifier.weight(1f)
) {
items(100) {
Box(
Modifier
.fillMaxWidth()
.height(56.dp)
) {
Text(text = "IT $it")
}
}
}
BasicTextField(
state = rememberTextFieldState(),
modifier = Modifier.imePadding().fillMaxWidth().background(Color.Cyan),
decorator = {
Box(Modifier.padding(24.dp)) {
it()
}
}
)
Box(
Modifier.fillMaxWidth().height(56.dp).background(Color.Gray)
) {
Text("Bottom bar")
}
}
Here is the simplest reproduction of the code, I know if I put the imePadding in the Column it will work fine, but it will pop up with the bottomBar, is there a way to do this if I just want the TextField to pop up with the ime?Nthily
05/23/2024, 9:53 AMHalil Ozercan
05/23/2024, 4:13 PMHalil Ozercan
05/23/2024, 4:14 PMNthily
05/23/2024, 4:17 PMTextFieldState to test it,
BasicTextField(
state = rememberTextFieldState()
but It doesn't seem to have anything to do with BTF? 🤔 I've also tested onValueChange of BTF and it has the same behavior, but havent test for Textfield for md3, etcNthily
05/25/2024, 3:08 AMHalil Ozercan
05/28/2024, 3:08 PMNthily
05/28/2024, 3:14 PMendbleEdgeToEdgeHalil Ozercan
05/28/2024, 3:58 PMconsumeWindowInsets modifier to let your layout know that your bottom bar is supposed to take some of the ime padding and the rest should be handled by the imePadding modifier.Halil Ozercan
05/28/2024, 3:58 PMColumn(Modifier.consumeWindowInsets(PaddingValues(vertical = 56.dp))) {
Box(
Modifier
.fillMaxWidth()
.height(56.dp)
.background(Color.Gray)
) {
Text("Top bar")
}
LazyColumn(
modifier = Modifier.weight(1f)
) {
items(100) {
Box(
Modifier
.fillMaxWidth()
.height(56.dp)
) {
Text(text = "IT $it")
}
}
}
var value by remember { mutableStateOf("") }
TextField(
value = value,
onValueChange = { value = it },
modifier = Modifier
.imePadding()
.fillMaxWidth()
.background(Color.Cyan),
)
Box(
Modifier
.fillMaxWidth()
.height(56.dp)
.background(Color.Red)
) {
Text("Bottom bar")
}
}Halil Ozercan
05/28/2024, 3:59 PMNthily
05/28/2024, 4:16 PMNthily
05/28/2024, 4:17 PMNthily
05/28/2024, 4:17 PMHalil Ozercan
05/28/2024, 4:25 PMHalil Ozercan
05/28/2024, 4:26 PMNthily
05/28/2024, 4:27 PM