Last active
May 27, 2020 11:24
-
-
Save ahmedrizwan/80c1a69e9112b1fdc3625b268aa6ed29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable() | |
fun SideView( | |
boxHeight: Dp, | |
drag: Drag | |
) { | |
val position = drag.position | |
val flingConfig = drag.flingConfig | |
val yOffset = with(DensityAmbient.current) { position.value.toDp() } | |
val toggleAsset = state { R.drawable.ic_keyboard_arrow_left_24 } | |
Box( | |
Modifier.offset(x = yOffset, y = 0.dp) | |
.fillMaxWidth() | |
.draggable( | |
startDragImmediately = position.isRunning, | |
dragDirection = DragDirection.Horizontal, | |
onDragStopped = { position.fling(flingConfig, it) } | |
) { delta -> | |
position.snapTo(position.value + delta) | |
delta | |
} | |
.preferredHeight(boxHeight), | |
backgroundColor = AppState.theme.primary, | |
gravity = ContentGravity.CenterStart | |
) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment