mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-07 19:14:12 +08:00
fix: no need alpha in inner box
This commit is contained in:
@@ -47,6 +47,7 @@ import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.highcapable.flexiui.LocalColors
|
||||
@@ -94,14 +95,12 @@ fun CheckBox(
|
||||
val animatedContentLayer by animateFloatAsState(if (checked) 1f else 0f)
|
||||
val sModifier = if (enabled) modifier else modifier.alpha(0.5f)
|
||||
Row(modifier = sModifier, verticalAlignment = Alignment.CenterVertically) {
|
||||
val cModifier = if (enabled)
|
||||
Modifier.clickable(
|
||||
Box(
|
||||
modifier = Modifier.clickable(
|
||||
enabled = enabled,
|
||||
interactionSource = interactionSource
|
||||
) { onCheckedChange(!checked) }
|
||||
else Modifier.alpha(0.5f)
|
||||
Box(
|
||||
modifier = cModifier.size(style.strokeSize)
|
||||
.size(style.strokeSize)
|
||||
.scale(animatedStrokeScale)
|
||||
.background(animatedColor, style.shape)
|
||||
.borderOrNot(style.border, style.shape),
|
||||
|
@@ -119,8 +119,8 @@ fun Switch(
|
||||
|
||||
@Composable
|
||||
fun Track(content: @Composable RowScope.() -> Unit) {
|
||||
val cModifier = if (enabled)
|
||||
Modifier.clickable(
|
||||
Row(
|
||||
modifier = Modifier.clickable(
|
||||
interactionSource = interactionSource,
|
||||
enabled = enabled,
|
||||
role = Role.Switch
|
||||
@@ -128,11 +128,7 @@ fun Switch(
|
||||
distance = maxOffset
|
||||
offsetX = if (checked) 0f else maxOffset
|
||||
onCheckedChange(!checked)
|
||||
}
|
||||
else Modifier.alpha(0.5f)
|
||||
Row(
|
||||
modifier = cModifier
|
||||
.background(if (efficientDragging) trackColor else animatedTrackColor, style.trackShape)
|
||||
}.background(if (efficientDragging) trackColor else animatedTrackColor, style.trackShape)
|
||||
.borderOrNot(style.trackBorder, style.trackShape)
|
||||
.size(style.trackWidth, style.trackHeight)
|
||||
.padding(start = padding, end = padding),
|
||||
|
Reference in New Issue
Block a user