mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
style(AppBar): Scrolled container color
This commit is contained in:
parent
1cc8abb599
commit
60ef9482c8
1 changed files with 6 additions and 6 deletions
|
@ -44,7 +44,7 @@ fun YokaiScaffold(
|
||||||
) {
|
) {
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
val useDarkIcons = MaterialTheme.colorScheme.surface.luminance() > .5
|
val useDarkIcons = MaterialTheme.colorScheme.surface.luminance() > .5
|
||||||
val color = getTopAppBarColor(title)
|
val (color, scrolledColor) = getTopAppBarColor(title)
|
||||||
|
|
||||||
SideEffect {
|
SideEffect {
|
||||||
val activity = view.context as Activity
|
val activity = view.context as Activity
|
||||||
|
@ -66,7 +66,7 @@ fun YokaiScaffold(
|
||||||
// modifier = Modifier.statusBarsPadding(),
|
// modifier = Modifier.statusBarsPadding(),
|
||||||
colors = topAppBarColors(
|
colors = topAppBarColors(
|
||||||
containerColor = color,
|
containerColor = color,
|
||||||
scrolledContainerColor = color,
|
scrolledContainerColor = scrolledColor,
|
||||||
),
|
),
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
ToolTipButton(
|
ToolTipButton(
|
||||||
|
@ -85,7 +85,7 @@ fun YokaiScaffold(
|
||||||
// modifier = Modifier.statusBarsPadding(),
|
// modifier = Modifier.statusBarsPadding(),
|
||||||
colors = topAppBarColors(
|
colors = topAppBarColors(
|
||||||
containerColor = color,
|
containerColor = color,
|
||||||
scrolledContainerColor = color,
|
scrolledContainerColor = scrolledColor,
|
||||||
),
|
),
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
ToolTipButton(
|
ToolTipButton(
|
||||||
|
@ -104,10 +104,10 @@ fun YokaiScaffold(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun getTopAppBarColor(title: String): Color {
|
fun getTopAppBarColor(title: String): Pair<Color, Color> {
|
||||||
return when (title.isEmpty()) {
|
return when (title.isEmpty()) {
|
||||||
true -> Color.Transparent
|
true -> Color.Transparent to Color.Transparent
|
||||||
false -> MaterialTheme.colorScheme.surface
|
false -> MaterialTheme.colorScheme.surface to MaterialTheme.colorScheme.surfaceContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue