Created
August 7, 2024 19:28
-
-
Save EfeBudak/707f987c44b29f6b57ce08e49fb753f7 to your computer and use it in GitHub Desktop.
Collect current offset of the bottom sheet
This file contains hidden or 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
fun SomeComposable(){ | |
val bottomSheetState = rememberStandardBottomSheetState() | |
val scaffoldState = rememberBottomSheetScaffoldState(bottomSheetState) | |
var currentOffset by remember { mutableFloatStateOf(0f) } | |
runCatching { | |
LaunchedEffect(bottomSheetState.requireOffset()) { | |
snapshotFlow { bottomSheetState.requireOffset() } | |
.collect { currentOffset = it } | |
} | |
} | |
// Here comes the BottomSheetScaffold | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment