Drawer blurs behind

This commit is contained in:
GG Bond authored and Vladimir Dostoyevskiy committed 2023-11-24 21:51:22 +08:00
1 parent 9e451c18d9
commit 0d00ae207a
1 file changed
+8 -2
@@ -32,6 +32,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.blur
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
@@ -47,6 +48,7 @@ import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.lerp
import androidx.compose.ui.util.lerp
import com.hippo.ehviewer.ui.tools.animateFloatMergeOneWayPredictiveBackAsState
import kotlin.math.roundToInt
@@ -298,7 +300,9 @@ fun ModalNavigationDrawer(
Modifier
}
Box(modifier.fillMaxSize().then(dragModifier)) {
Box {
val step = calculateFraction(minValue, maxValue, drawerState.currentOffset)
val radius = lerp(0.dp, 10.dp, step)
Box(modifier = Modifier.blur(radius)) {
content()
}
Scrim(
@@ -419,7 +423,9 @@ fun SideDrawer(
Modifier
}
Box(modifier.fillMaxSize().then(dragModifier)) {
Box {
val step = calculateFraction(minValue, maxValue, drawerState.currentOffset)
val radius = lerp(0.dp, 10.dp, step)
Box(modifier = Modifier.blur(radius)) {
content()
}
Scrim(