mirror of
https://github.com/meowarex/rl-mobile.git
synced 2026-08-27 06:27:46 +10:00
Revert to Legacy Sliders <3
This commit is contained in:
+14
-83
@@ -114,7 +114,7 @@ fun RadiantTextField(
|
||||
}
|
||||
|
||||
/**
|
||||
* Slider with a gradient and glow.
|
||||
* Slider. (i prefer the old on tbh so i reverted it back <3)
|
||||
*/
|
||||
@Composable
|
||||
fun RadiantSlider(
|
||||
@@ -124,12 +124,10 @@ fun RadiantSlider(
|
||||
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
|
||||
steps: Int = 0,
|
||||
enabled: Boolean = true,
|
||||
showStopIndicator: Boolean = true,
|
||||
onValueChangeFinished: (() -> Unit)? = null,
|
||||
) {
|
||||
val scheme = MaterialTheme.colorScheme
|
||||
val interaction = remember(::MutableInteractionSource)
|
||||
|
||||
if (radiantStyle.native) {
|
||||
if (showStopIndicator) {
|
||||
Slider(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
@@ -139,51 +137,18 @@ fun RadiantSlider(
|
||||
enabled = enabled,
|
||||
modifier = modifier,
|
||||
)
|
||||
return
|
||||
} else {
|
||||
Slider(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
onValueChangeFinished = onValueChangeFinished,
|
||||
valueRange = valueRange,
|
||||
steps = steps,
|
||||
enabled = enabled,
|
||||
modifier = modifier,
|
||||
track = { SliderDefaults.Track(sliderState = it, drawStopIndicator = null) },
|
||||
)
|
||||
}
|
||||
|
||||
Slider(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
onValueChangeFinished = onValueChangeFinished,
|
||||
valueRange = valueRange,
|
||||
steps = steps,
|
||||
enabled = enabled,
|
||||
interactionSource = interaction,
|
||||
modifier = modifier,
|
||||
track = { state ->
|
||||
val fraction = if (valueRange.endInclusive > valueRange.start) {
|
||||
((state.value - valueRange.start) / (valueRange.endInclusive - valueRange.start))
|
||||
.coerceIn(0f, 1f)
|
||||
} else 0f
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(6.dp)
|
||||
.clip(CircleShape)
|
||||
.background(scheme.surfaceContainerHighest),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(fraction)
|
||||
.fillMaxHeight()
|
||||
.clip(CircleShape)
|
||||
.background(accentBrush),
|
||||
)
|
||||
}
|
||||
},
|
||||
thumb = {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.glow(scheme.primary, 10.dp, CircleShape, alpha = 0.6f)
|
||||
.size(20.dp)
|
||||
.clip(CircleShape)
|
||||
.background(scheme.onPrimary, CircleShape)
|
||||
.border(3.dp, scheme.primary, CircleShape),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,37 +235,3 @@ fun RadiantSegmented(
|
||||
}
|
||||
|
||||
/** something.. */
|
||||
@Composable
|
||||
fun RadiantLabeledSlider(
|
||||
label: String,
|
||||
value: Float,
|
||||
onValueChange: (Float) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
|
||||
steps: Int = 0,
|
||||
trailingText: String? = null,
|
||||
) {
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = label,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
if (trailingText != null) {
|
||||
Text(
|
||||
text = trailingText,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
}
|
||||
RadiantSlider(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
valueRange = valueRange,
|
||||
steps = steps,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -354,6 +354,7 @@ private fun SliderOptionRow(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
valueRange = valueRange,
|
||||
showStopIndicator = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ private val Rose80 = Color(0xFFFFAFCC)
|
||||
private val Rose90 = Color(0xFFFFD9E4)
|
||||
private val Rose95 = Color(0xFFFFECF1)
|
||||
|
||||
// ── Violet (secondary) ───────────────────────────────────────────────────────
|
||||
private val Violet10 = Color(0xFF25004E)
|
||||
private val Violet20 = Color(0xFF3D177A)
|
||||
private val Violet30 = Color(0xFF553194)
|
||||
private val Violet40 = Color(0xFF6E4BAF)
|
||||
private val Violet80 = Color(0xFFD6BBFF)
|
||||
private val Violet90 = Color(0xFFECDCFF)
|
||||
// ── Dusty rose (secondary) ───────────────────────────────────────────────────
|
||||
private val DustyRose10 = Color(0xFF2B0D18)
|
||||
private val DustyRose20 = Color(0xFF43202B)
|
||||
private val DustyRose30 = Color(0xFF5C3541)
|
||||
private val DustyRose40 = Color(0xFF774C58)
|
||||
private val DustyRose80 = Color(0xFFE4BCC8)
|
||||
private val DustyRose90 = Color(0xFFF5DCE4)
|
||||
|
||||
// ── Aqua (tertiary) ──────────────────────────────────────────────────────────
|
||||
private val Aqua10 = Color(0xFF00201F)
|
||||
@@ -89,10 +89,10 @@ val RadiantDarkColorScheme: ColorScheme = darkColorScheme(
|
||||
onPrimaryContainer = Rose90,
|
||||
inversePrimary = Rose40,
|
||||
|
||||
secondary = Violet80,
|
||||
onSecondary = Violet20,
|
||||
secondaryContainer = Violet30,
|
||||
onSecondaryContainer = Violet90,
|
||||
secondary = DustyRose80,
|
||||
onSecondary = DustyRose20,
|
||||
secondaryContainer = DustyRose30,
|
||||
onSecondaryContainer = DustyRose90,
|
||||
|
||||
tertiary = Aqua80,
|
||||
onTertiary = Aqua20,
|
||||
@@ -134,10 +134,10 @@ val RadiantLightColorScheme: ColorScheme = lightColorScheme(
|
||||
onPrimaryContainer = Rose10,
|
||||
inversePrimary = Rose80,
|
||||
|
||||
secondary = Violet40,
|
||||
secondary = DustyRose40,
|
||||
onSecondary = Neutral100,
|
||||
secondaryContainer = Violet90,
|
||||
onSecondaryContainer = Violet10,
|
||||
secondaryContainer = DustyRose90,
|
||||
onSecondaryContainer = DustyRose10,
|
||||
|
||||
tertiary = Aqua40,
|
||||
onTertiary = Neutral100,
|
||||
|
||||
Reference in New Issue
Block a user