Guilherme Delgado
04/11/2025, 10:06 AMScaffold
with a TopAppBar
and a PullToRefreshBox
, and passing innerPadding
to a LazyVerticalStaggeredGrid
(or any other layout that only composes and lays out visible items on screen), we need to do this:
Scaffold(
topBar = {...}
) { innerPadding ->
PullToRefreshBox(
...,
indicator = {
Indicator(
modifier = Modifier
.align(Alignment.TopCenter)
.padding(top = innerPadding.calculateTopPadding()),
isRefreshing = isRefreshing,
state = pullState
)
}
) {
LazyVerticalStaggeredGrid(contentPadding = innerPadding, ...) {...}
}
}
To ensure both work correctly. If the calculateTopPadding
is ignored, the pull-to-refresh functionality doesn’t work properly. Is this the intended solution or is there a better way to achieve this?Chrimaeon
04/11/2025, 10:53 AMGuilherme Delgado
04/11/2025, 11:10 AMChrimaeon
04/11/2025, 11:15 AMGuilherme Delgado
04/11/2025, 11:16 AMGuilherme Delgado
04/11/2025, 11:19 AMGuilherme Delgado
04/11/2025, 11:19 AMGuilherme Delgado
04/11/2025, 11:20 AMChrimaeon
04/11/2025, 11:20 AMGuilherme Delgado
04/11/2025, 11:21 AM