Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored code to be more idiomatic #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MarcelGarus
Copy link

@MarcelGarus MarcelGarus commented Apr 8, 2019

Refactored code to be more idiomatic according to the official Effective Dart Style Guide.

Readme:

  • Removed constructor documentation and moved it to the code as dartdoc comments. This way, they'll be available in various code editors by hovering over the constructor and they'll also appear in the automatically generated pub documentation of the code.

Core library:

  • Reordered constructor, parameters and methods to match the recommended Flutter code style.
  • Added various assertions.
  • Assertions are now done in the constructor's initializer list instead of a body.
  • Discouraged function typedef inlined (used only once anyway).
  • Removed unnecessary new constructor keywords, as recommended since Dart 2.
  • Removed unnecessary double indication by .0 as recommended since Dart 2.1 in places where doubles are obviously expected.
  • Simplified second if expression from index > rating - (allowHalfRating ? 0.5 : 1.0) && index < rating to allowHalfRating && index > rating - 1.
  • Replaced repeated if (this.onRatingChanged != null) checks with a simply dummy function.
  • Replaced .round().toDouble() with more efficient .roundToDouble().
  • Replaced verbose if (newRating > starCount) { newRating = starCount.toDouble(); } if (newRating < 0) { newRating = 0.0; } with more idiomatic .clamp(0.0, starCount.toDouble()).
  • Fixed indentation and code layout in various places using dartfmt.

Example:

  • minor improvements.

Pubspec:

  • Bumped version
  • Removed unnecessary comments from flutter create
  • Added me as an author

Bumped version.
Removed placeholder comments from `Flutter create`.
Added me as an author.
@MarcelGarus
Copy link
Author

I'm pretty confident in the edits I made and tested the widget superficially, but be sure to do some thorough testing before merging it in the base branch.

@thangmam
Copy link
Owner

hello @MarcelGarus thanks for the pull request .Please add yourself as a contributor to this project.I will be happy to merge your pull request.Thanks again

@MarcelGarus
Copy link
Author

MarcelGarus commented May 12, 2019

@thangmam As far as I'm aware, only the repo maintainer can add contributors or users automatically become contributors if the code they wrote ends up in the repo...
Are there any licensing terms I have to agree to in order to become a contributor?

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.

2 participants