Using WindowsInsets(android tutorial) in app with jetpack compose, doesn't show on @Preview.
Here my Modifier.windowInsetsPadding(WindowInsets.safeContent) does not apply as Preview.
If I replace windowsInsetsPadding with padding(24.dp) it's apply as preview.
I feel like the Preview doesn't know about WindowsInsets of the current device selected in preview.
Maybe WindowsInsets is not intented to be used on Preview?
@Composable
internal fun SignInRoute(
modifier: Modifier = Modifier,
viewModel: SignInViewModel = hiltViewModel(),
) {
SignInScreen()
}
@Composable
internal fun SignInScreen(
) {
Column(
modifier = Modifier
.fillMaxSize()
.windowInsetsPadding(WindowInsets.safeContent),
horizontalAlignment = Alignment.CenterHorizontally
) {
// Content ...
}
}
@Preview
@Composable
private fun SignInScreenPreview() {
MaterialTheme {
Surface(
color = MaterialTheme.colorScheme.background
) {
SignInScreen()
}
}
}

There is a Feature Request open in the Google Issue Tracker that is asking for this exact functionality. The issue still is open, but was assigned to an employee, so I think what you are asking for is not yet possible. You can upvote the issue or ask in a comment about the situation to draw more attention to it.