11import 'package:cook_chef/Screens/AccountPage.dart' ;
2+ import 'package:cook_chef/Widgets/IncredientsList.dart' ;
23import 'package:flutter/cupertino.dart' ;
34import 'package:flutter/material.dart' ;
45import 'package:flutter_svg/svg.dart' ;
@@ -18,77 +19,75 @@ class _RecipesPageState extends State<RecipesPage> {
1819 bool isHindi = false ;
1920 bool isSetup = false ;
2021
21- List ingredients = new List ();
22+ // List ingredients = new List();
2223
23- Widget renderIngredients () {
24- return ListView .builder (
25- itemCount: ingredients.length,
26- itemBuilder: (context, index) {
27- return ingredients[index][0 ];
28- });
29- }
24+ // SizedBox _setupIngredients() {
25+ // isSetup = true;
26+ // for (int i = 0; i < 5; i++) {
27+ // _addIngredients(
28+ // image: AssetImage('assets/images/allspice.jpeg'),
29+ // text: 'Allspice',
30+ // index: i);
31+ // }
32+ // return SizedBox();
33+ // }
3034
31- SizedBox _setupIngredients () {
32- isSetup = true ;
33- for (int i = 0 ; i < 5 ; i++ ) {
34- _addIngredients (
35- image: AssetImage ('assets/images/allspice.jpeg' ),
36- text: 'Allspice' ,
37- index: i);
38- }
39- return SizedBox ();
40- }
35+ // void _addIngredients({AssetImage image, String text, int index}) {
36+ // List data = new List();
37+ // data.add(_createIngredient(image: image, text: text, index: index));
38+ // data.add(false);
39+ // ingredients.add(data);
40+ // }
4141
42- void _addIngredients ({AssetImage image, String text, int index}) {
43- List data = new List ();
44- data.add (_createIngredient (image: image, text: text, index: index));
45- data.add (false );
46- ingredients.add (data);
47- }
48-
49- Container _createIngredient ({AssetImage image, String text, int index}) {
50- return Container (
51- margin: EdgeInsets .symmetric (vertical: 6.0 , horizontal: 10.0 ),
52- child: Row (
53- children: < Widget > [
54- CircleAvatar (
55- radius: 27 ,
56- backgroundColor: Colors .black,
57- child: CircleAvatar (
58- radius: 25 ,
59- backgroundImage: image,
60- ),
61- ),
62- SizedBox (
63- width: 10.0 ,
64- ),
65- Expanded (
66- flex: 1 ,
67- child: Text (text),
68- ),
69- GestureDetector (
70- onTap: () {
71- setState (() {
72- isChecked = ingredients[index][1 ];
73- isChecked = ! isChecked;
74- ingredients[index][1 ] = isChecked;
75- print (isChecked);
76- });
77- },
78- child: isChecked
79- ? Icon (
80- Icons .check_circle,
81- color: Colors .green,
82- )
83- : Icon (Icons .check_circle_outline),
84- ),
85- ],
86- ),
87- );
88- }
42+ // Container _createIngredient({AssetImage image, String text, int index}) {
43+ // return Container(
44+ // margin: EdgeInsets.symmetric(vertical: 6.0, horizontal: 10.0),
45+ // child: Row(
46+ // children: <Widget>[
47+ // CircleAvatar(
48+ // radius: 27,
49+ // backgroundColor: Colors.black,
50+ // child: CircleAvatar(
51+ // radius: 25,
52+ // backgroundImage: image,
53+ // ),
54+ // ),
55+ // SizedBox(
56+ // width: 10.0,
57+ // ),
58+ // Expanded(
59+ // flex: 1,
60+ // child: Text(text),
61+ // ),
62+ // GestureDetector(
63+ // onTap: () {
64+ // setState(() {
65+ // isChecked = ingredients[index][1];
66+ // isChecked = !isChecked;
67+ // ingredients[index][1] = isChecked;
68+ // print(isChecked);
69+ // });
70+ // },
71+ // child: Icon(
72+ // Icons.check_circle,
73+ // color: isChecked ? Colors.green : Colors.blue,
74+ // ),
75+ // ),
76+ // ],
77+ // ),
78+ // );
79+ // }
8980
9081 @override
9182 Widget build (BuildContext context) {
83+ // Widget renderIngredients() {
84+ // return ListView.builder(
85+ // itemCount: ingredients.length,
86+ // itemBuilder: (context, index) {
87+ // return ingredients[index][0];
88+ // });
89+ // }
90+
9291 final _width = MediaQuery .of (context).size.width;
9392
9493 return Scaffold (
@@ -154,10 +153,11 @@ class _RecipesPageState extends State<RecipesPage> {
154153 Container (
155154 margin: EdgeInsets .all (3.0 ),
156155 decoration: BoxDecoration (
157- color: Colors .white,
158- borderRadius: BorderRadius .all (
159- Radius .circular (15.0 ),
160- )),
156+ color: Colors .white,
157+ borderRadius: BorderRadius .all (
158+ Radius .circular (15.0 ),
159+ ),
160+ ),
161161 height: 18 ,
162162 width: 15 ,
163163 ),
@@ -186,10 +186,10 @@ class _RecipesPageState extends State<RecipesPage> {
186186 // ),
187187 // ),
188188 // ),
189- if (! isSetup) _setupIngredients (),
189+ // if (!isSetup) _setupIngredients(),
190190 Container (
191191 child: Expanded (
192- child: renderIngredients (),
192+ child: IncredientsList (),
193193 ),
194194 ),
195195 Container (
0 commit comments