Added null safety to 'steps' in Slider object
This commit is contained in:
parent
32416efe50
commit
9b35f31afa
2 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ sealed class Preference {
|
|||
val value: Int,
|
||||
val min: Int = 0,
|
||||
val max: Int,
|
||||
val steps: Int = 0,
|
||||
val steps: Int? = null,
|
||||
override val title: String = "",
|
||||
override val subtitle: String? = null,
|
||||
override val icon: ImageVector? = null,
|
||||
|
|
|
@ -161,7 +161,7 @@ fun SliderItem(
|
|||
onChange: (Int) -> Unit,
|
||||
max: Int,
|
||||
min: Int = 0,
|
||||
steps: Int = 0,
|
||||
steps: Int? = null,
|
||||
) {
|
||||
val haptic = LocalHapticFeedback.current
|
||||
|
||||
|
@ -194,7 +194,7 @@ fun SliderItem(
|
|||
},
|
||||
modifier = Modifier.weight(1.5f),
|
||||
valueRange = min.toFloat()..max.toFloat(),
|
||||
steps = if (steps > 0) steps else max - min,
|
||||
steps = steps ?: (max - min),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue