compose-ratingbar
compose-ratingbar copied to clipboard
Rating value is calculated incorrectly
The rating value computation function is very sensitive to padding. When padding is 3.dp - everything is fine
But if the padding is large, then
- It register misclicks between stars
- the calculated value exceeds the maximum
for example
var rating: Float by rememberSaveable { mutableStateOf(0f) }
Column() {
Text(text = rating.toString())
RatingBar(
value = rating,
size = 20.dp,
padding = 30.dp,
numStars = 3,
ratingBarStyle = RatingBarStyle.HighLighted,
onRatingChanged = {
rating=it
})
}
max value is 9
Currently, rating value is calculated from the full width of the ratingbar. I will check the workaround and taking this issue as a low priority.
The calculating algorithm is unuseful. Please increase the priority of this task. Thanks.
@tidimito thanks for creating this issue. my bad it should have been fixed earlier. fixed in 1.3.0 now