mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Migrate Slider to the SliderState API
material3 1.5.0-alpha28 removed the value-based Slider overload that accepts custom thumb and track. Keep the public signature of our wrapper and remember a SliderState internally, as the deprecated material3 overload does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-4
@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.SliderColors
|
||||
import androidx.compose.material3.SliderDefaults
|
||||
import androidx.compose.material3.SliderState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -60,16 +61,16 @@ fun Slider(
|
||||
}
|
||||
}
|
||||
}
|
||||
val sliderState = remember(steps, valueRange) { SliderState(value = value, steps = steps, trackRange = valueRange) }
|
||||
sliderState.value = value
|
||||
androidx.compose.material3.Slider(
|
||||
value = value,
|
||||
state = sliderState,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
valueRange = valueRange,
|
||||
steps = steps,
|
||||
onValueChangeFinished = onValueChangeFinish,
|
||||
colors = colors,
|
||||
thumb = {
|
||||
thumb = { _ ->
|
||||
if (useCustomLayout) {
|
||||
SliderDefaults.Thumb(
|
||||
modifier = Modifier.drawWithContent {
|
||||
|
||||
Reference in New Issue
Block a user