Bring the search bar back into view when pressing back
This commit is contained in:
@@ -219,6 +219,8 @@ fun PagerScaffold(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val searchBarOffset = remember { mutableStateOf(0f) }
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
BackHandler {
|
BackHandler {
|
||||||
when {
|
when {
|
||||||
@@ -235,6 +237,9 @@ fun PagerScaffold(
|
|||||||
scope.launch {
|
scope.launch {
|
||||||
widgetsScrollState.animateScrollTo(0)
|
widgetsScrollState.animateScrollTo(0)
|
||||||
}
|
}
|
||||||
|
scope.launch {
|
||||||
|
searchBarOffset.animateTo(0f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +248,6 @@ fun PagerScaffold(
|
|||||||
|
|
||||||
val gestureManager = LocalGestureDetector.current
|
val gestureManager = LocalGestureDetector.current
|
||||||
|
|
||||||
val searchBarOffset = remember { mutableStateOf(0f) }
|
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
val maxSearchBarOffset = with(density) { 128.dp.toPx() }
|
val maxSearchBarOffset = with(density) { 128.dp.toPx() }
|
||||||
|
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ fun PullDownScaffold(
|
|||||||
scope.launch {
|
scope.launch {
|
||||||
widgetsScrollState.animateScrollTo(0)
|
widgetsScrollState.animateScrollTo(0)
|
||||||
}
|
}
|
||||||
|
scope.launch {
|
||||||
|
searchBarOffset.animateTo(0f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user