compose-collapsing-toolbar
compose-collapsing-toolbar copied to clipboard
Can't collapse the toolbar when swiping up from the toolbar content
Hi,
I have rather big tool bar that holds an image pager (Google Accompanist pager) and the toolbar does not collapsed while swiping up. I tested it on simpler toolbar as well.
Can you clarify what is your expected behavior? Do you mean that when scrolling the main content, the toolbar does not get collapsed until the pager (VerticalPager?) hits the bottom?
Hi, Sorry for the late response.
I have a screen with a collapsing toolbar and a list, when i try to scroll up and the gesture start from within the toolbar it self. its not collapsing.
I finally managed to proxy the event by using this code:
CollapsingToolbarScaffold(
modifier = Modifier
.fillMaxSize()
.scrollable(
orientation = Orientation.Vertical,
// allow to scroll from within the toolbar
state = rememberScrollableState { delta ->
collapsingToolbarState.toolbarState.dispatchRawDelta(delta)
delta
}
),
state = collapsingToolbarState,
.
.
.
I have confirmed that the Android's CollapsingToolbarLayout consumes scrolling gestures from toolbar. Thank you for reporting!
I have a way to deal with it temporarily
toolbarModifier = Modifier.verticalScroll(rememberScrollState())
CollapsingToolbarScaffold(
modifier = Modifier.fillMaxSize(),
state = rememberCollapsingToolbarScaffoldState(),
toolbarModifier = Modifier.verticalScroll(rememberScrollState()),
scrollStrategy = ScrollStrategy.ExitUntilCollapsed,
toolbar = {
// toolbar contents...
}
) {
// body contents...
}
Like this, slide the toolbar and the NestedScrollConnection can receive events