Skip to content

Commit e6a2515

Browse files
committed
emotion icons rating bar added
1 parent 2c70c26 commit e6a2515

File tree

2 files changed

+15
-56
lines changed

2 files changed

+15
-56
lines changed

example/lib/main.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,22 +256,21 @@ class _MyHomePageState extends State<MyHomePage>
256256

257257
GFRating(
258258
value: _rating,
259-
// filledIcon: Icon(
260-
// Icons.sentiment_very_satisfied,
261-
// color: Colors.green,
262-
// size: 50,
263-
// ),
264-
// halfFilledIcon: Icon(
265-
// Icons.sentiment_neutral,
266-
// color: Colors.amber,
267-
// size: 50,
268-
// ),
269-
// defaultIcon: Icon(
270-
// Icons.sentiment_very_dissatisfied,
271-
// color: Colors.red,
272-
// size: 50,
273-
// ),
274-
emoticon: true,
259+
filledIcon: Icon(
260+
Icons.sentiment_very_satisfied,
261+
color: Colors.green,
262+
size: 50,
263+
),
264+
halfFilledIcon: Icon(
265+
Icons.sentiment_neutral,
266+
color: Colors.amber,
267+
size: 50,
268+
),
269+
defaultIcon: Icon(
270+
Icons.sentiment_very_dissatisfied,
271+
color: Colors.red,
272+
size: 50,
273+
),
275274
onChanged: (value) {
276275
setState(() {
277276
_rating = value;

lib/components/rating/gf_rating.dart

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class GFRating extends StatefulWidget {
2222
this.inputDecorations,
2323
this.margin = const EdgeInsets.symmetric(vertical: 16),
2424
this.padding = const EdgeInsets.symmetric(horizontal: 16),
25-
this.emoticon = false,
2625
}) : assert(value != null);
2726

2827
/// defines total number of rating items
@@ -76,8 +75,6 @@ class GFRating extends StatefulWidget {
7675
/// defines the padding of rating [TextFormField]
7776
final EdgeInsets padding;
7877

79-
final bool emoticon;
80-
8178
@override
8279
_GFRatingState createState() => _GFRatingState();
8380
}
@@ -114,43 +111,6 @@ class _GFRatingState extends State<GFRating> {
114111
);
115112
}
116113

117-
if(widget.emoticon){
118-
if(widget.value == 1){
119-
return Icon(
120-
Icons.sentiment_very_dissatisfied,
121-
color: Colors.red,
122-
size: 40,
123-
);
124-
} else if(widget.value == 2){
125-
return Icon(
126-
Icons.sentiment_dissatisfied,
127-
color: Colors.redAccent,
128-
size: 40,
129-
);
130-
} else if(widget.value == 3){
131-
return Icon(
132-
Icons.sentiment_neutral,
133-
color: Colors.amber,
134-
size: 40,
135-
);
136-
} else if(widget.value == 4){
137-
return Icon(
138-
Icons.sentiment_satisfied,
139-
color: Colors.lightGreen,
140-
size: 40,
141-
);
142-
} else {
143-
return Icon(
144-
Icons.sentiment_satisfied,
145-
color: Colors.green,
146-
size: 40,
147-
);
148-
}
149-
}
150-
151-
152-
153-
154114
return GestureDetector(
155115
onTap: () {
156116
if (widget.onChanged != null) {

0 commit comments

Comments
 (0)