-
-
Save egorikftp/898ef570175a3b80bfb8f88631fb82a2 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
@OptIn(ExperimentalMaterialApi::class) | |
val BottomSheetScaffoldState.currentFraction: Float | |
get() { | |
val fraction = bottomSheetState.progress.fraction | |
val targetValue = bottomSheetState.targetValue | |
val currentValue = bottomSheetState.currentValue | |
return when { | |
currentValue == Collapsed && targetValue == Collapsed -> 0f | |
currentValue == Expanded && targetValue == Expanded -> 1f | |
currentValue == Collapsed && targetValue == Expanded -> fraction | |
else -> 1f - fraction | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment