Update to follow the latest material slider specs
Tick size is 4 dp now.
This commit is contained in:
1 parent
e0f16f31e6
commit
556b726349
2 files changed
+3
-6
No files matched your search
@@ -29,6 +29,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@Composable
|
||||
fun SpinnerChoice(title: String, entries: Array<String>, values: Array<String>, field: MutableState<Int>) {
|
||||
@@ -97,9 +98,7 @@ fun SliderChoice(
|
||||
) {
|
||||
startSlot()
|
||||
val configuration = LocalConfiguration.current
|
||||
// https://m3.material.io/components/sliders/specs
|
||||
// Tick width is 2 dp
|
||||
val maxTickCount = configuration.screenWidthDp / 6
|
||||
val maxTickCount = configuration.screenWidthDp / (SliderDefaults.TickSize.value * 2.5f).roundToInt()
|
||||
val steps = range.last - range.first - 1
|
||||
val showTicks = steps < maxTickCount
|
||||
Slider(
|
||||
|
||||
@@ -43,9 +43,7 @@ fun ChapterNavigator(
|
||||
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
|
||||
val view = LocalView.current
|
||||
val configuration = LocalConfiguration.current
|
||||
// https://m3.material.io/components/sliders/specs
|
||||
// Tick width is 2 dp
|
||||
val maxTickCount = configuration.screenWidthDp / 6
|
||||
val maxTickCount = configuration.screenWidthDp / (SliderDefaults.TickSize.value * 2.5f).roundToInt()
|
||||
val showTicks = totalPages < maxTickCount
|
||||
|
||||
// Match with toolbar background color set in ReaderActivity
|
||||
|
||||
Reference in new issue
Block a user