Skip to content

Instantly share code, notes, and snippets.

@hkawii
Last active July 13, 2022 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkawii/88b0f0cd82a378f2b0a497f02ace63b1 to your computer and use it in GitHub Desktop.
Save hkawii/88b0f0cd82a378f2b0a497f02ace63b1 to your computer and use it in GitHub Desktop.
@Composable
fun MenuView(
modifier: Modifier = Modifier,
menuSections: List<MenuSections> = FakeData.menuData
) {
val scope = rememberCoroutineScope()
...
...
MenuItemsView(
menuSections = menuSections,
itemsListState = itemsListState,
onPostScroll = {
val currentSectionIndex = itemsListState.firstVisibleItemIndex
if (selectedSectionIndex != currentSectionIndex) {
selectedSectionIndex = currentSectionIndex
scope.launch {
sectionsListState.animateScrollToItem(currentSectionIndex)
}
}
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment