compose-ratingbar icon indicating copy to clipboard operation
compose-ratingbar copied to clipboard

Rating value is calculated incorrectly

Open vitidev opened this issue 3 years ago • 1 comments

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

  1. It register misclicks between stars
  2. 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

vitidev avatar Aug 20 '21 11:08 vitidev

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.

a914-gowtham avatar Aug 23 '21 19:08 a914-gowtham

The calculating algorithm is unuseful. Please increase the priority of this task. Thanks.

tidimito avatar Nov 25 '22 15:11 tidimito

@tidimito thanks for creating this issue. my bad it should have been fixed earlier. fixed in 1.3.0 now

a914-gowtham avatar May 27 '23 13:05 a914-gowtham