Hello, I am running into an issue properly padding...
# compose
s
Hello, I am running into an issue properly padding for ime and pinning the TopAppBar to the top of the screen. I mimicked the Jetchat sample to accomplish this. Using compose multiplatform there is a large space between the keyboard and input box. The same code in the Jetchat example works as expected. Any idea what I’m doing wrong? ``````
Copy code
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
val scrollState = rememberLazyListState()

Scaffold(
    topBar = {
        TopAppBar(
            title = { Text("Hello Top Bar") },
            scrollBehavior = scrollBehavior
        )
    },
    contentWindowInsets = ScaffoldDefaults
        .contentWindowInsets
        .exclude(WindowInsets.navigationBars)
        .exclude(WindowInsets.ime),
    modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),

    content = { paddingValues ->
        Column(Modifier.fillMaxSize().padding(paddingValues)) {
            LazyColumn(modifier = Modifier.weight(1f).fillMaxSize(), state = scrollState) {
                items(150) {
                    Text(text = "Item $it")
                }
            }
            val textState = remember { mutableStateOf("Enter text here...") }
            OutlinedTextField(
                value = textState.value,
                onValueChange = { textState.value = it },
                modifier = Modifier
                    .navigationBarsPadding().imePadding()
            )
        }
    }
)
a
Do you by any chance have a Scaffold wrapping this scaffold somewhere up in the tree
if yes, you should consume the insets so the paddings do not get applied anymore
image.png
this is the top level scaffold
s
does this work for you? I've tried many things and not able to get it to work correctly. I can get the ime padding to work correctly, but the entire screen shifts up when the keyboard opens, hiding the TopBar
a
Thats how it works insents must be consumed so they do not get applied more than once