Skip to content

Commit

Permalink
Merge pull request #83 from Konyaco/component/refactor_slider
Browse files Browse the repository at this point in the history
[fluent] Refactor Slider component
  • Loading branch information
Sanlorng authored Nov 30, 2024
2 parents 7ec1bd5 + 9b22a61 commit 84f6317
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ fun ColorPicker(
}
val (hug, saturation, _) = spectrumColor.value.hsv()
Slider(
modifier = Modifier.padding(top = 21.dp).width(312.dp).height(32.dp),
value = value,
onValueChange = {
onSelectedColorChanged(
Expand Down Expand Up @@ -137,19 +138,14 @@ fun ColorPicker(
)
)
},
track = { _, _ -> },
thumb = { fraction, maxWidth, dragging ->
SliderDefaults.Thumb(
fraction = fraction,
maxWidth = maxWidth,
dragging = dragging,
color = FluentTheme.colors.text.text.primary
)
},
modifier = Modifier.padding(top = 21.dp).width(312.dp).height(32.dp)
track = { },
thumb = { state ->
SliderDefaults.Thumb(state, color = FluentTheme.colors.text.text.primary)
}
)
if (alphaEnabled) {
Slider(
modifier = Modifier.width(312.dp),
value = alpha,
onValueChange = {
onSelectedColorChanged(color.copy(alpha = it))
Expand All @@ -169,16 +165,10 @@ fun ColorPicker(
)
)
},
track = { _, _ -> },
thumb = { fraction, maxWidth, dragging ->
SliderDefaults.Thumb(
fraction = fraction,
maxWidth = maxWidth,
dragging = dragging,
color = FluentTheme.colors.text.text.primary
)
},
modifier = Modifier.width(312.dp).height(32.dp)
track = {},
thumb = { state ->
SliderDefaults.Thumb(state, color = FluentTheme.colors.text.text.primary)
}
)
}
Spacer(modifier = Modifier.height(20.dp))
Expand Down
Loading

0 comments on commit 84f6317

Please sign in to comment.