Skip to content

Enforce maxRating limit in RatingBar value calculation#109

Open
Rasubosu wants to merge 1 commit intosarbagyastha:mainfrom
Rasubosu:fix-max-rating-value-range
Open

Enforce maxRating limit in RatingBar value calculation#109
Rasubosu wants to merge 1 commit intosarbagyastha:mainfrom
Rasubosu:fix-max-rating-value-range

Conversation

@Rasubosu
Copy link
Copy Markdown

@Rasubosu Rasubosu commented Jan 13, 2024

Dear sarbagyastha

Issue:
We observed that tapping on the rating bar could inadvertently allow users to set a rating higher than the maxRating, which should not be possible. This inconsistency can lead to unexpected behavior, particularly when a specific maxRating is set.

Implemented Fix:
To resolve this, I have adjusted the rating calculation logic to ensure that the rating value does not go beyond maxRating when the widget is tapped. The key change is:

value = math.min(value, widget.maxRating ?? widget.itemCount.toDouble());

Here is a video of the issue

Enforce.maxRating.limit.in.RatingBar.value.calculation.2024-01-13.23.44.43.mov

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant