Skip to content

Commit 492b308

Browse files
committed
rating definations
1 parent b9d9b2a commit 492b308

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

example/lib/main.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,15 @@ class _MyHomePageState extends State<MyHomePage>
216216

217217
GFRating(
218218
rating: rating,
219-
// size: 65,
220-
filledIconData: Icons.star,
221-
halfFilledIconData: Icons.star_half,
222-
defaultIconData: Icons.star_border,
219+
// iconSize: 65,
220+
filledIcon: Icons.star,
221+
halfFilledIcon: Icons.star_half,
222+
defaultIcon: Icons.star_border,
223223
itemCount: 5,
224224
allowHalfRating: false,
225225
// spacing: 2.0,
226+
color: Colors.teal,
227+
borderColor: Colors.tealAccent,
226228
onRatingChanged: (value) {
227229
setState(() {
228230
rating = value;

lib/components/rating/gf_rating.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GFRating extends StatelessWidget {
1212
this.onRatingChanged,
1313
this.color,
1414
this.borderColor,
15-
this.size = 25,
15+
this.iconSize = 25,
1616
this.filledIcon,
1717
this.halfFilledIcon,
1818
this.allowHalfRating = true,
@@ -25,7 +25,7 @@ class GFRating extends StatelessWidget {
2525
final RatingChangeCallback onRatingChanged;
2626
final Color color;
2727
final Color borderColor;
28-
final double size;
28+
final double iconSize;
2929
final bool allowHalfRating;
3030
final IconData filledIcon;
3131
final IconData halfFilledIcon;
@@ -39,20 +39,20 @@ class GFRating extends StatelessWidget {
3939
icon = Icon(
4040
defaultIcon != null ? defaultIcon : Icons.star_border,
4141
color: borderColor ?? Theme.of(context).primaryColor,
42-
size: size,
42+
size: iconSize,
4343
);
4444
} else if (index > rating - (allowHalfRating ? 0.5 : 1.0) &&
4545
index < rating) {
4646
icon = Icon(
4747
halfFilledIcon != null ? halfFilledIcon : Icons.star_half,
4848
color: color ?? Theme.of(context).primaryColor,
49-
size: size,
49+
size: iconSize,
5050
);
5151
} else {
5252
icon = Icon(
5353
filledIcon != null ? filledIcon : Icons.star,
5454
color: color ?? Theme.of(context).primaryColor,
55-
size: size,
55+
size: iconSize,
5656
);
5757
}
5858

0 commit comments

Comments
 (0)