diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 53ae0ae..b6e61b6 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,4 @@ android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx1536M +android.enableR8=true diff --git a/example/lib/main.dart b/example/lib/main.dart index 2802c95..8ac1e14 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -23,10 +23,12 @@ class _MyAppState extends State { body: Center( child: SmoothStarRating( rating: rating, - size: 45, - fullRatedIconData: Icons.blur_off, - halfRatedIconData: Icons.blur_on, + size: 65, + filledIconData: Icons.star, + halfFilledIconData: Icons.star_half, + defaultIconData: Icons.star_border, starCount: 5, + allowHalfRating: false, spacing: 2.0, onRatingChanged: (value) { setState(() { diff --git a/lib/smooth_star_rating.dart b/lib/smooth_star_rating.dart index 69da383..3de2e40 100644 --- a/lib/smooth_star_rating.dart +++ b/lib/smooth_star_rating.dart @@ -13,19 +13,22 @@ class SmoothStarRating extends StatelessWidget { final Color borderColor; final double size; final bool allowHalfRating; - final IconData fullRatedIconData; - final IconData halfRatedIconData; + final IconData filledIconData; + final IconData halfFilledIconData; + final IconData + defaultIconData; //this is needed only when having fullRatedIconData && halfRatedIconData final double spacing; SmoothStarRating({ this.starCount = 5, this.spacing, this.rating = 0.0, + this.defaultIconData, this.onRatingChanged, this.color, this.borderColor, this.size = 25, - this.fullRatedIconData, - this.halfRatedIconData, + this.filledIconData, + this.halfFilledIconData, this.allowHalfRating = true, }) { assert(this.rating != null); @@ -35,20 +38,20 @@ class SmoothStarRating extends StatelessWidget { Icon icon; if (index >= rating) { icon = new Icon( - fullRatedIconData != null ? fullRatedIconData : Icons.star_border, + defaultIconData != null ? defaultIconData : Icons.star_border, color: borderColor ?? Theme.of(context).primaryColor, size: size, ); } else if (index > rating - (allowHalfRating ? 0.5 : 1.0) && index < rating) { icon = new Icon( - halfRatedIconData != null ? halfRatedIconData : Icons.star_half, + halfFilledIconData != null ? halfFilledIconData : Icons.star_half, color: color ?? Theme.of(context).primaryColor, size: size, ); } else { icon = new Icon( - fullRatedIconData != null ? fullRatedIconData : Icons.star, + filledIconData != null ? filledIconData : Icons.star, color: color ?? Theme.of(context).primaryColor, size: size, ); diff --git a/pubspec.yaml b/pubspec.yaml index a8d24fa..0b993f2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,6 @@ name: smooth_star_rating description: A smooth rating bar version: 1.0.4 -author: Thangmam homepage: https://github.com/thangmam/smoothratingbar.git environment: