Skip to content

fix: onRatingUpdate called with wrong state#104

Open
asci-00 wants to merge 1 commit intosarbagyastha:mainfrom
asci-00:fix-onRatingUpdate-callback
Open

fix: onRatingUpdate called with wrong state#104
asci-00 wants to merge 1 commit intosarbagyastha:mainfrom
asci-00:fix-onRatingUpdate-callback

Conversation

@asci-00
Copy link
Copy Markdown

@asci-00 asci-00 commented Nov 26, 2023

Thank you for providing flutter_rating_bar.
There is something I would like to contribute while using this, so I would like to request a PR.

Problem

  • When the iconRating is changed, onRatingUpdate is not called immediately, so if the _rating state changes quickly, the iconRating value referenced by _onDragUpdate / _onDragEnd may not be up to date.

Describe your changes

  • Separated ratingOffset into commonly used states rather than individual methods. (_ratingOffset)
  • IconRating did not seem to need to be dependent on the index, so I modified it to be a getter based on the _rating value independently. It seems to be working well in my code. Could you please give me some feedback on this?
  • Modified the no-rating / half-rating / full-rating conditions by modifying the iconRating calculation method. This part may also be different from what you intended, so please give me feedback and I will correct it.

Issue ticket number and link

#76

@asci-00
Copy link
Copy Markdown
Author

asci-00 commented Dec 7, 2023

@sarbagyastha Could you review this PR?

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