79691242

Date: 2025-07-05 18:18:06
Score: 0.5
Natty:
Report link

The problem is that the Material3 Scaffold component has had a mandatory parameter change (since Material3 version 1.2.0+). In Compose Material3, as of version 1.2.0, there is now a mandatory content parameter that now takes an argument of type (PaddingValues) -> Unit. It passes the internal screen padding to be taken into account.

Solving my problem using FirstScreen as an example:

@Composable
fun FirstScreen(onNavigate: () -> Unit) {
    Scaffold { innerPadding ->
        Column(
            modifier = Modifier
                .fillMaxSize()
                .padding(innerPadding) // IMPORTANT: add this line !
                .padding(16.dp),
            verticalArrangement = Arrangement.Center
        ) {
            Text(text = "Это первый экран")
            Spacer(modifier = Modifier.height(16.dp))
            Button(onClick = onNavigate) {
                Text("Перейти на второй экран")
            }
        }
    }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: NolReaction