style(AppBar): Partially revert 71dcb2ab but adjust the color to

primaryContainer
This commit is contained in:
Ahmad Ansori Palembani 2024-12-27 07:42:06 +07:00
parent 71dcb2ab85
commit 8a9d8166af
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -29,7 +29,6 @@ import dev.icerock.moko.resources.compose.stringResource
import yokai.i18n.MR
import yokai.presentation.component.ToolTipButton
import yokai.presentation.core.ExpandedAppBar
import yokai.util.applyElevationOverlay
@Composable
fun YokaiScaffold(
@ -46,7 +45,7 @@ fun YokaiScaffold(
) {
val view = LocalView.current
val useDarkIcons = MaterialTheme.colorScheme.surface.luminance() > .5
val color = getTopAppBarColor(title)
val (color, scrolledColor) = getTopAppBarColor(title)
SideEffect {
val activity = view.context as Activity
@ -68,7 +67,7 @@ fun YokaiScaffold(
// modifier = Modifier.statusBarsPadding(),
colors = topAppBarColors(
containerColor = color,
scrolledContainerColor = color.applyElevationOverlay(4.dp),
scrolledContainerColor = scrolledColor,
),
navigationIcon = {
ToolTipButton(
@ -87,7 +86,7 @@ fun YokaiScaffold(
// modifier = Modifier.statusBarsPadding(),
colors = topAppBarColors(
containerColor = color,
scrolledContainerColor = color.applyElevationOverlay(4.dp),
scrolledContainerColor = scrolledColor,
),
navigationIcon = {
ToolTipButton(
@ -106,10 +105,10 @@ fun YokaiScaffold(
}
@Composable
fun getTopAppBarColor(title: String): Color {
fun getTopAppBarColor(title: String): Pair<Color, Color> {
return when (title.isEmpty()) {
true -> Color.Transparent
false -> MaterialTheme.colorScheme.surface
true -> Color.Transparent to Color.Transparent
false -> MaterialTheme.colorScheme.surface to MaterialTheme.colorScheme.primaryContainer
}
}