Это создает пространство на вырезе, проблема в том, что пространство находится в то время, вместо этого я бы хотел, чтобы он имел тот же цвет TopAppBar.
Вот мой код:< /p>
Код: Выделить всё
@Composable
fun Theme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val colors = if (darkTheme) DarkColorPalette else LightColorPalette
MaterialTheme(
colors = colors,
typography = Typography,
content = content
)
}
Код: Выделить всё
class PaymentActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val tableNumber = intent.getStringExtra("tableNumber") ?: ""
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.light(
resources.getColor(R.color.colorPrimary, theme),
resources.getColor(R.color.colorPrimary, theme)
)
)
setContent {
VisualPOSMobileTheme {
PaymentScreen(tableNumber = tableNumber,
onPaymentProceed = { amount, tipAmount ->
println("Proceed Payment: Total = $amount, Tip = $tipAmount")
},
onBackClick = { finish() })
}
}
}
}
Код: Выделить всё
Scaffold(
modifier = Modifier.safeDrawingPadding(),
topBar = {
TopAppBar(
title = {
Text(text = "Pagamento")
},
navigationIcon = {
IconButton(onClick = onBackClick) {
Icon(
painter = painterResource(R.drawable.ic_baseline_arrow_back_ios_new_24),
contentDescription = "Indietro"
)
}
},
backgroundColor = MaterialTheme.colors.primary,
contentColor = Color.White,
elevation = 4.dp
)
},
...
Вот как это происходит выглядит так:

Итак, как мне установить цвет statusBar такой же, как у TopAppBar?
Подробнее здесь: https://stackoverflow.com/questions/792 ... ingpadding
Мобильная версия