Olivier Patry
03/07/2021, 11:37 AMBackdropScaffold
with a nullable front content.
The front content is well displayed when not null, then when state is updated to null
previous state remains.
@Composable
fun AppScreen() {
val viewModel = viewModel()
val state by viewModel.state.observeAsState(null)
BackdropScaffold(
appBar = { },
backLayerContent = {
Column(
Modifier.fillMaxWidth()
) {
//
Text("BACK")
}
},
frontLayerContent = {
state?.let { uiState ->
Text("FRONT")
}
}
)
}
To workaround this, I had to add an empty box:
state?.let { uiState ->
Text("FRONT")
} ?: Box {}
Is it expected?
When the state is null at the beginning nothing is displayed as expected without the workaround.nglauber
03/07/2021, 1:57 PMheaderHeight
as `0.dp`…
BackdropScaffold(
appBar = {},
backLayerContent = {
// You content...
},
headerHeight = if (!shouldShow) 0.dp else BackdropScaffoldDefaults.HeaderHeight,
frontLayerContent = {
// Your header
},
scaffoldState = state,
stickyFrontLayer = false
)
Hope to see a better solution…