From 2bf77f1d814b411f8bd50bffcbca82b88064a2b0 Mon Sep 17 00:00:00 2001 From: Prasidh Gopal Anchan Date: Mon, 16 Oct 2023 02:40:01 +0530 Subject: [PATCH] Fix checkboxes not working after scrolling in filter sheet (#10023) Fixed an issue where CheckBox was not being checked after scrolling in the Filter tab --- .../presentation/core/components/AdaptiveSheet.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt index eea05b4cab..51fb672ee2 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt @@ -167,7 +167,10 @@ fun AdaptiveSheet( .offset { IntOffset( 0, - anchoredDraggableState.offset.takeIf { it.isFinite() }?.roundToInt() ?: 0, + anchoredDraggableState.offset + .takeIf { it.isFinite() } + ?.roundToInt() + ?: 0, ) } .anchoredDraggable( @@ -238,8 +241,13 @@ private fun AnchoredDraggableState.preUpPostDownNestedScrollConnection() } override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity { - settle(velocity = available.toFloat()) - return available + val toFling = available.toFloat() + return if (toFling > 0) { + settle(toFling) + available + } else { + Velocity.Zero + } } private fun Float.toOffset(): Offset = Offset(0f, this)