Bring the search bar back into view when pressing back

This commit is contained in:
MM20 2023-01-21 13:34:07 +01:00
parent 5cb52863a1
commit b0f3ddf325
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 8 additions and 1 deletions

View File

@ -219,6 +219,8 @@ fun PagerScaffold(
}
}
val searchBarOffset = remember { mutableStateOf(0f) }
val scope = rememberCoroutineScope()
BackHandler {
when {
@ -235,6 +237,9 @@ fun PagerScaffold(
scope.launch {
widgetsScrollState.animateScrollTo(0)
}
scope.launch {
searchBarOffset.animateTo(0f)
}
}
}
}
@ -243,7 +248,6 @@ fun PagerScaffold(
val gestureManager = LocalGestureDetector.current
val searchBarOffset = remember { mutableStateOf(0f) }
val density = LocalDensity.current
val maxSearchBarOffset = with(density) { 128.dp.toPx() }

View File

@ -259,6 +259,9 @@ fun PullDownScaffold(
scope.launch {
widgetsScrollState.animateScrollTo(0)
}
scope.launch {
searchBarOffset.animateTo(0f)
}
}
}
}