Add hoverable to scrollbar

pull/722/head
TJ Dahunsi 2 years ago
parent 31b4841cb2
commit 795c5e32a9

@ -21,6 +21,7 @@ import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.gestures.draggable import androidx.compose.foundation.gestures.draggable
import androidx.compose.foundation.gestures.rememberDraggableState import androidx.compose.foundation.gestures.rememberDraggableState
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@ -221,9 +222,10 @@ fun Scrollbar(
Box( Box(
modifier = modifier modifier = modifier
.run { .run {
val withHover = interactionSource?.let(::hoverable) ?: this
when (orientation) { when (orientation) {
Orientation.Vertical -> fillMaxHeight() Orientation.Vertical -> withHover.fillMaxHeight()
Orientation.Horizontal -> fillMaxWidth() Orientation.Horizontal -> withHover.fillMaxWidth()
} }
} }
.onGloballyPositioned { coordinates -> .onGloballyPositioned { coordinates ->

Loading…
Cancel
Save