@@ -22,6 +22,7 @@ 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 ,
2526 }) : assert (value != null );
2627
2728 /// defines total number of rating items
@@ -75,6 +76,8 @@ class GFRating extends StatefulWidget {
7576 /// defines the padding of rating [TextFormField]
7677 final EdgeInsets padding;
7778
79+ final bool emoticon;
80+
7881 @override
7982 _GFRatingState createState () => _GFRatingState ();
8083}
@@ -111,6 +114,43 @@ class _GFRatingState extends State<GFRating> {
111114 );
112115 }
113116
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+
114154 return GestureDetector (
115155 onTap: () {
116156 if (widget.onChanged != null ) {
0 commit comments