Skip to content

Commit 0bdeb3e

Browse files
committed
refactor: apply PR comments
1 parent c07d659 commit 0bdeb3e

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

slider/src/main/java/io/monstarlab/mosaic/slider/Modifiers.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ internal fun Modifier.sliderDragModifier(
2222
enabled = enabled,
2323
interactionSource = interactionSource,
2424
startDragImmediately = state.isDragging,
25-
reverseDirection = isRtl,
26-
onDragStopped = {},
25+
reverseDirection = isRtl
2726
)
2827

2928
internal fun Modifier.sliderTapModifier(
@@ -35,7 +34,6 @@ internal fun Modifier.sliderTapModifier(
3534
this.pointerInput(state, interactionSource) {
3635
detectTapGestures(
3736
onPress = { state.handlePress(it) },
38-
onTap = { state.dispatchRawDelta(0f) },
3937
)
4038
}
4139
} else {

slider/src/main/java/io/monstarlab/mosaic/slider/Slider.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import androidx.compose.ui.unit.LayoutDirection
1818

1919
/**
2020
* A composable function that creates a slider UI component.
21-
*
2221
* @param value the current value of the slider
2322
* @param onValueChange a callback function invoked when the slider value changes
2423
* @param enabled - determines whether the user can interact with the slide or not
@@ -56,7 +55,7 @@ public fun Slider(
5655
// this means the value has been coerced into it
5756
// for this case the change of value must be explicitly notified to the receiver
5857
LaunchedEffect(initialValue) {
59-
if (initialValue.value != state.value) {
58+
if (initialValue.floatValue != state.value) {
6059
onValueChange(state.value)
6160
}
6261
}
@@ -75,8 +74,7 @@ public fun Slider(
7574
* A composable function that creates a slider UI component.
7675
* @param state of the Slider where the latest slider value is stored
7776
* @param colors the colors used to customize the appearance of the slider
78-
* @param modifier the modifier to be applied to the slider overall. Use to manipulate the behaviour in other layouts,
79-
* @param trackModifier - Modifier to be applied to the Track, U
77+
* @param modifier the modifier to be applied to the slider.
8078
* @param enabled - determines whether the user can interact with the slide or not
8179
* @param interactionSource the interaction source used to handle user input interactions
8280
* @param thumb the composable function used to render the slider thumb

slider/src/main/java/io/monstarlab/mosaic/slider/SliderColors.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,34 @@ public class SliderColors(
1212
/**
1313
* Color of the active track representing the track to the start of the thumb
1414
*/
15-
public val activeTrackColor: Color,
15+
private val activeTrackColor: Color,
1616
/**
1717
* Represents the color of the disabled range,
1818
* where user is not able to put a thumb to
1919
*/
20-
public val disabledRangeTrackColor: Color = activeTrackColor,
20+
internal val disabledRangeTrackColor: Color = activeTrackColor,
2121
/**
2222
* Color of the Inactive track, to the end of the thumb
2323
*/
24-
public val inactiveTrackColor: Color = activeTrackColor.copy(alpha = 0.5f),
24+
private val inactiveTrackColor: Color = activeTrackColor.copy(alpha = 0.5f),
2525
/**
2626
* Active track color when the Slider is disabled and user can't interact with it
2727
*/
28-
public val disabledActiveTrackColor: Color = activeTrackColor.copy(alpha = 0.2f),
28+
private val disabledActiveTrackColor: Color = activeTrackColor.copy(alpha = 0.2f),
2929
/**
3030
* Color of the Inactive track when the Slider is disabled
3131
*/
32-
public val disabledInactiveTrackColor: Color = activeTrackColor.copy(alpha = 0.2f),
32+
private val disabledInactiveTrackColor: Color = activeTrackColor.copy(alpha = 0.2f),
3333
/**
3434
* Color of the thumb
3535
* only applied when the default thumb is used
3636
*/
37-
public val thumbColor: Color = activeTrackColor,
37+
private val thumbColor: Color = activeTrackColor,
3838
/**
3939
* Color of the thumb when the Slider is disabled
4040
* Only applied when the default thumb is used
4141
*/
42-
public val disabledThumbColor: Color = inactiveTrackColor,
42+
private val disabledThumbColor: Color = inactiveTrackColor,
4343
) {
4444
@Stable
4545
public fun activeTrackColor(enabled: Boolean): Color {

slider/src/main/java/io/monstarlab/mosaic/slider/SliderLayout.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public fun SliderLayout(
2727
thumb(state)
2828
}
2929
},
30-
) { mesuarables, constraints ->
30+
) { measurables, constraints ->
3131

32-
val thumbPlaceable = mesuarables
32+
val thumbPlaceable = measurables
3333
.first { it.layoutId == SliderLayoutElements.Thumb }
3434
.measure(constraints)
3535

36-
val trackPlaceable = mesuarables
36+
val trackPlaceable = measurables
3737
.first { it.layoutId == SliderLayoutElements.Track }
3838
.measure(
3939
constraints.offset(

0 commit comments

Comments
 (0)