@@ -12,47 +12,69 @@ class GFRating extends StatelessWidget {
1212 this .onRatingChanged,
1313 this .color,
1414 this .borderColor,
15- this .iconSize = 25 ,
15+ this .itemSize = 25 ,
1616 this .filledIcon,
1717 this .halfFilledIcon,
1818 this .allowHalfRating = true ,
1919 }) {
2020 assert (this .rating != null );
2121 }
2222
23+ /// defines total number of rating items
2324 final int itemCount;
24- final double rating;
25- final RatingChangeCallback onRatingChanged;
25+
26+ /// defines the color of items
2627 final Color color;
28+
29+ /// defines the border color of [halfFilledIcon]
2730 final Color borderColor;
28- final double iconSize;
31+
32+ /// defines the size of items
33+ final double itemSize;
34+
35+ /// if true, allow half rating of items. Default it will be in true state
2936 final bool allowHalfRating;
37+
38+ /// defines the items when filled
3039 final IconData filledIcon;
40+
41+ /// defines the items when half-filled
3142 final IconData halfFilledIcon;
32- final IconData defaultIcon; //this is needed only when having fullRatedIconData && halfRatedIconData
43+
44+ /// defines the default items, when having filledIcon && halfFilledIcon
45+ final IconData defaultIcon;
46+
47+ /// defines the space between items
3348 final double spacing;
3449
50+ /// defines the rating value
51+ final double rating;
52+
53+ /// return current rating whenever rating is updated
54+ final RatingChangeCallback onRatingChanged;
55+
56+
3557
3658 Widget buildRatingBar (BuildContext context, int index) {
3759 Icon icon;
3860 if (index >= rating) {
3961 icon = Icon (
4062 defaultIcon != null ? defaultIcon : Icons .star_border,
4163 color: borderColor ?? Theme .of (context).primaryColor,
42- size: iconSize ,
64+ size: itemSize ,
4365 );
4466 } else if (index > rating - (allowHalfRating ? 0.5 : 1.0 ) &&
4567 index < rating) {
4668 icon = Icon (
4769 halfFilledIcon != null ? halfFilledIcon : Icons .star_half,
4870 color: color ?? Theme .of (context).primaryColor,
49- size: iconSize ,
71+ size: itemSize ,
5072 );
5173 } else {
5274 icon = Icon (
5375 filledIcon != null ? filledIcon : Icons .star,
5476 color: color ?? Theme .of (context).primaryColor,
55- size: iconSize ,
77+ size: itemSize ,
5678 );
5779 }
5880
0 commit comments