shading colors

This commit is contained in:
Diogo
2024-09-02 10:25:17 +01:00
parent ac84e1da64
commit b878fd21b3
2 changed files with 14 additions and 5 deletions
@@ -398,22 +398,29 @@ fun UserPicker(
}
}
}
val resultingColor = if (isInDarkTheme()) Color.Black.copy(0.64f) else DrawerDefaults.scrimColor
val animatedColor = remember {
Animatable(
if (newChat.isVisible()) Color.Transparent else resultingColor,
Color.VectorConverter(resultingColor.colorSpace)
)
}
AnimatedVisibility(
visible = newChat.isVisible(),
enter = if (appPlatform.isAndroid) {
slideInVertically(
initialOffsetY = { it },
animationSpec = tween(durationMillis = 300)
) + fadeIn(animationSpec = tween(durationMillis = 300))
animationSpec = userPickerAnimSpec()
) + fadeIn(animationSpec = userPickerAnimSpec())
} else {
fadeIn()
},
exit = if (appPlatform.isAndroid) {
slideOutVertically(
targetOffsetY = { it },
animationSpec = tween(durationMillis = 300)
) + fadeOut(animationSpec = tween(durationMillis = 300))
animationSpec = userPickerAnimSpec()
) + fadeOut(animationSpec = userPickerAnimSpec())
} else {
fadeOut()
}
@@ -421,7 +428,7 @@ fun UserPicker(
Box(
Modifier
.fillMaxSize()
.then(if (appPlatform.isAndroid && newChat.isVisible()) Modifier.background(color = MaterialTheme.colors.onSurface.copy(alpha = if (isInDarkTheme()) 0.16f else 0.32f)) else Modifier)
.drawBehind { drawRect(animatedColor.value) }
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null, onClick = { userPickerState.value = AnimatedViewState.HIDING }),
contentAlignment = if (appPlatform.isAndroid) Alignment.BottomStart else Alignment.TopStart
) {
@@ -7,3 +7,5 @@ fun <T> chatListAnimationSpec() = tween<T>(durationMillis = 250, easing = FastOu
fun <T> newChatSheetAnimSpec() = tween<T>(256, 0, LinearEasing)
fun <T> audioProgressBarAnimationSpec() = tween<T>(durationMillis = 30, easing = LinearEasing)
fun <T> userPickerAnimSpec() = tween<T>(256, 0, FastOutSlowInEasing)