fix: disable not effect in Slider and TextField

This commit is contained in:
2023-11-14 01:59:01 +08:00
parent f5d37462f2
commit 5ef9f21ef2
2 changed files with 6 additions and 3 deletions

View File

@@ -63,7 +63,9 @@ import com.highcapable.flexiui.LocalColors
import com.highcapable.flexiui.LocalShapes
import com.highcapable.flexiui.LocalSizes
import com.highcapable.flexiui.utils.borderOrNot
import com.highcapable.flexiui.utils.status
import kotlin.math.roundToInt
@Immutable
data class SliderColors(
val trackInactiveColor: Color,
@@ -165,9 +167,10 @@ fun Slider(
)
}
Box(
modifier = modifier.hoverable(interactionSource)
modifier = modifier.status(enabled)
.hoverable(interactionSource, enabled)
.pointerInput(Unit) {
detectTapGestures(
if (enabled) detectTapGestures(
onTap = { offset ->
val tapedOffsetX = offset.x - thumbRadius.toPx()
offsetX = tapedOffsetX.coerceIn(0f, maxOffset)

View File

@@ -267,7 +267,7 @@ private fun Modifier.textField(
enabled: Boolean,
interactionSource: MutableInteractionSource
) = status(enabled)
.hoverable(interactionSource)
.hoverable(interactionSource, enabled)
.clip(style.shape)
.background(colors.backgroundColor, style.shape)
.borderOrNot(border, style.shape)