diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt index 6a1fa88cc..b38f1d0cf 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt @@ -2,6 +2,7 @@ package com.x8bit.bitwarden.ui.tools.feature.generator +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row @@ -49,6 +50,7 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.core.net.toUri import androidx.hilt.navigation.compose.hiltViewModel @@ -582,6 +584,7 @@ private fun ColumnScope.PasswordTypeContent( ) } +@OptIn(ExperimentalMaterial3Api::class) @Suppress("LongMethod") @Composable private fun PasswordLengthSliderItem( @@ -646,6 +649,12 @@ private fun PasswordLengthSliderItem( .width(16.dp + labelTextWidth + 16.dp), ) + val colors = SliderDefaults.colors( + activeTickColor = Color.Transparent, + inactiveTickColor = Color.Transparent, + disabledActiveTickColor = Color.Transparent, + disabledInactiveTickColor = Color.Transparent, + ) Slider( value = sliderValue.toFloat(), onValueChange = { newValue -> @@ -656,16 +665,27 @@ private fun PasswordLengthSliderItem( }, valueRange = sliderRange, steps = maxValue - 1, - colors = SliderDefaults.colors( - activeTickColor = Color.Transparent, - inactiveTickColor = Color.Transparent, - disabledActiveTickColor = Color.Transparent, - disabledInactiveTickColor = Color.Transparent, - ), + colors = colors, + thumb = { + SliderDefaults.Thumb( + interactionSource = remember { MutableInteractionSource() }, + colors = colors, + thumbSize = DpSize(width = 20.dp, height = 20.dp), + ) + }, + track = { sliderState -> + SliderDefaults.Track( + modifier = Modifier.height(height = 4.dp), + drawStopIndicator = null, + colors = colors, + sliderState = sliderState, + thumbTrackGapSize = 0.dp, + ) + }, modifier = Modifier .focusProperties { canFocus = false } - .testTag("PasswordLengthSlider") - .weight(1f), + .testTag(tag = "PasswordLengthSlider") + .weight(weight = 1f), ) } }