From 80752ffbf5a13f8b4575dba47ffd8107c5b6c1fa Mon Sep 17 00:00:00 2001 From: Abel 'Akronix' Serrano Juste Date: Fri, 1 Aug 2025 17:30:11 +0200 Subject: [PATCH] Make scrollbar thumb size configurable This change introduces a constant `THUMB_SIZE` to control the size of the scrollbar thumb, making it easier to adjust its appearance. --- .../designsystem/component/scrollbar/AppScrollbars.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/designsystem/src/main/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/component/scrollbar/AppScrollbars.kt b/core/designsystem/src/main/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/component/scrollbar/AppScrollbars.kt index 1086e280b..553a5fa82 100644 --- a/core/designsystem/src/main/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/component/scrollbar/AppScrollbars.kt +++ b/core/designsystem/src/main/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/component/scrollbar/AppScrollbars.kt @@ -65,6 +65,11 @@ import kotlinx.coroutines.delay */ private const val SCROLLBAR_INACTIVE_TO_DORMANT_TIME_IN_MS = 2_000L +/** + * The size of the scrollbar thumb + */ +private const val THUMB_SIZE = 12 + /** * A [Scrollbar] that allows for fast scrolling of content by dragging its thumb. * Its thumb disappears when the scrolling container is dormant. @@ -136,8 +141,8 @@ private fun ScrollableState.DraggableScrollbarThumb( modifier = Modifier .run { when (orientation) { - Vertical -> width(12.dp).fillMaxHeight() - Horizontal -> height(12.dp).fillMaxWidth() + Vertical -> width(THUMB_SIZE.dp).fillMaxHeight() + Horizontal -> height(THUMB_SIZE.dp).fillMaxWidth() } } .scrollThumb(this, interactionSource),