mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 19:44:25 +08:00
fix: disable not effect in Slider and TextField
This commit is contained in:
@@ -63,7 +63,9 @@ import com.highcapable.flexiui.LocalColors
|
|||||||
import com.highcapable.flexiui.LocalShapes
|
import com.highcapable.flexiui.LocalShapes
|
||||||
import com.highcapable.flexiui.LocalSizes
|
import com.highcapable.flexiui.LocalSizes
|
||||||
import com.highcapable.flexiui.utils.borderOrNot
|
import com.highcapable.flexiui.utils.borderOrNot
|
||||||
|
import com.highcapable.flexiui.utils.status
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class SliderColors(
|
data class SliderColors(
|
||||||
val trackInactiveColor: Color,
|
val trackInactiveColor: Color,
|
||||||
@@ -165,9 +167,10 @@ fun Slider(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.hoverable(interactionSource)
|
modifier = modifier.status(enabled)
|
||||||
|
.hoverable(interactionSource, enabled)
|
||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectTapGestures(
|
if (enabled) detectTapGestures(
|
||||||
onTap = { offset ->
|
onTap = { offset ->
|
||||||
val tapedOffsetX = offset.x - thumbRadius.toPx()
|
val tapedOffsetX = offset.x - thumbRadius.toPx()
|
||||||
offsetX = tapedOffsetX.coerceIn(0f, maxOffset)
|
offsetX = tapedOffsetX.coerceIn(0f, maxOffset)
|
||||||
|
@@ -267,7 +267,7 @@ private fun Modifier.textField(
|
|||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
interactionSource: MutableInteractionSource
|
interactionSource: MutableInteractionSource
|
||||||
) = status(enabled)
|
) = status(enabled)
|
||||||
.hoverable(interactionSource)
|
.hoverable(interactionSource, enabled)
|
||||||
.clip(style.shape)
|
.clip(style.shape)
|
||||||
.background(colors.backgroundColor, style.shape)
|
.background(colors.backgroundColor, style.shape)
|
||||||
.borderOrNot(border, style.shape)
|
.borderOrNot(border, style.shape)
|
||||||
|
Reference in New Issue
Block a user