@@ -40,10 +40,14 @@ class _MyHomePageState extends State<MyHomePage>
4040 GlobalKey <ScaffoldState >();
4141
4242 TabController tabController;
43+ final _ratingController = TextEditingController ();
44+ double _rating = 3.5 ;
45+ double _userRating = 4.5 ;
4346
4447 @override
4548 void initState () {
4649 super .initState ();
50+ _ratingController.text = '4.5' ;
4751 tabController = TabController (length: 3 , vsync: this );
4852 }
4953
@@ -67,8 +71,6 @@ class _MyHomePageState extends State<MyHomePage>
6771 'Xamarin2' ,
6872 ];
6973
70- double rating = 3.5 ;
71-
7274 @override
7375 Widget build (BuildContext context) => Scaffold (
7476 drawer: GFDrawer (
@@ -174,10 +176,16 @@ class _MyHomePageState extends State<MyHomePage>
174176// Container(color: Colors.blue)
175177// ]),
176178
179+ <<<<<< < HEAD
180+ SingleChildScrollView (
181+ child: Column (
182+ mainAxisAlignment: MainAxisAlignment .center,
183+ ====== =
177184// SingleChildScrollView(
178185// child:
179186 Column (
180187 mainAxisAlignment: MainAxisAlignment .start,
188+ >>>>>> > ccc97fde38d7e90bca8ef572ba85c4254a92c687
181189 crossAxisAlignment: CrossAxisAlignment .center,
182190 children: < Widget > [
183191 GFSearchBar (
@@ -214,50 +222,106 @@ class _MyHomePageState extends State<MyHomePage>
214222 }),
215223
216224 GFRating (
217- rating: rating,
218- // itemSize: 65,
219- filledIcon: Icons .star,
220- halfFilledIcon: Icons .star_half,
221- defaultIcon: Icons .star_border,
222- itemCount: 5 ,
223- allowHalfRating: false ,
224- spacing: 2 ,
225+ rating: _rating,
226+ itemSize: 50 ,
227+ // filledIcon: Image.asset(
228+ // 'lib/assets/heart.png',
229+ // height: 50,
230+ // width: 50,
231+ // color: Colors.amber,
232+ // ),
233+ // halfFilledIcon: Image.asset(
234+ // 'lib/assets/heart_half.png',
235+ // height: 50,
236+ // width: 50,
237+ // color: Colors.amber,
238+ // ),
239+ // defaultIcon: Image.asset(
240+ // 'lib/assets/heart_border.png',
241+ // height: 50,
242+ // width: 50,
243+ // color: Colors.amber,
244+ // ),
245+ // allowHalfRating: false,
246+ spacing: 8 ,
225247 color: Colors .teal,
226248 borderColor: Colors .tealAccent,
227249 onRatingChanged: (value) {
228250 setState (() {
229- rating = value;
251+ _rating = value;
252+ print ('user selected $_rating ' );
230253 });
231254 },
232255 ),
233256
234- GFCard (
235- content: Column (
236- children: < Widget > [
237- const GFTypography (
238- text: 'Toast' ,
239- type: GFTypographyType .typo6,
240- ),
241- const SizedBox (
242- height: 20 ,
243- ),
244- const SizedBox (
245- height: 20 ,
246- ),
247- GFToast (
248- text: 'Happy New Year' ,
249- button: GFButton (
250- onPressed: () {
251- print ('dfr' );
252- },
253- text: 'OK' ,
254- type: GFButtonType .outline,
255- color: GFColor .warning,
256- ),
257- ),
258- ],
257+ SizedBox (
258+ height: 20 ,
259+ child: Text ('selected rating ${_rating .toStringAsFixed (1 )}' ),
260+ ),
261+
262+ GFRating (
263+ rating: _userRating,
264+ itemSize: 50 ,
265+ filledIcon: Image .asset (
266+ 'lib/assets/heart.png' ,
267+ height: 50 ,
268+ width: 50 ,
269+ color: Colors .amber,
270+ ),
271+ halfFilledIcon: Image .asset (
272+ 'lib/assets/heart_half.png' ,
273+ height: 50 ,
274+ width: 50 ,
275+ color: Colors .amber,
276+ ),
277+ defaultIcon: Image .asset (
278+ 'lib/assets/heart_border.png' ,
279+ height: 50 ,
280+ width: 50 ,
281+ color: Colors .amber,
282+ ),
283+ ratingController: _ratingController,
284+ textFormRating: true ,
285+ spacing: 8 ,
286+ color: Colors .teal,
287+ borderColor: Colors .tealAccent,
288+ suffixIcon: MaterialButton (
289+ onPressed: () {
290+ setState (() {
291+ _userRating = double .parse (_ratingController.text ?? '0.0' );
292+ });
293+ },
294+ child: const Text ('Rate' ),
259295 ),
260296 ),
297+
298+ // GFCard(
299+ // content: Column(
300+ // children: <Widget>[
301+ // const GFTypography(
302+ // text: 'Toast',
303+ // type: GFTypographyType.typo6,
304+ // ),
305+ // const SizedBox(
306+ // height: 20,
307+ // ),
308+ // const SizedBox(
309+ // height: 20,
310+ // ),
311+ // GFToast(
312+ // text: 'Happy New Year',
313+ // button: GFButton(
314+ // onPressed: () {
315+ // print('dfr');
316+ // },
317+ // text: 'OK',
318+ // type: GFButtonType.outline,
319+ // color: GFColor.warning,
320+ // ),
321+ // ),
322+ // ],
323+ // ),
324+ // ),
261325//
262326// GFCard(
263327// content: Column(
0 commit comments