Skip to content

Commit 4ff55ba

Browse files
authored
Merge pull request #1 from Vivek0004/master
List View
2 parents 3cee4d1 + 286fad5 commit 4ff55ba

2 files changed

Lines changed: 90 additions & 90 deletions

File tree

lib/Screens/RecipesPage.dart

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:cook_chef/Screens/AccountPage.dart';
2+
import 'package:cook_chef/Widgets/IncredientsList.dart';
23
import 'package:flutter/cupertino.dart';
34
import 'package:flutter/material.dart';
45
import '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(

pubspec.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.4.2"
10+
version: "2.5.0-nullsafety.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.0.0"
17+
version: "2.1.0-nullsafety.1"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.0.0"
24+
version: "1.1.0-nullsafety.3"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.1.3"
31+
version: "1.2.0-nullsafety.1"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.0.1"
38+
version: "1.1.0-nullsafety.1"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.13"
45+
version: "1.15.0-nullsafety.3"
4646
convert:
4747
dependency: transitive
4848
description:
@@ -63,7 +63,7 @@ packages:
6363
name: fake_async
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "1.1.0"
66+
version: "1.2.0-nullsafety.1"
6767
flutter:
6868
dependency: "direct main"
6969
description: flutter
@@ -87,21 +87,21 @@ packages:
8787
name: matcher
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "0.12.8"
90+
version: "0.12.10-nullsafety.1"
9191
meta:
9292
dependency: transitive
9393
description:
9494
name: meta
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "1.1.8"
97+
version: "1.3.0-nullsafety.3"
9898
path:
9999
dependency: transitive
100100
description:
101101
name: path
102102
url: "https://pub.dartlang.org"
103103
source: hosted
104-
version: "1.7.0"
104+
version: "1.8.0-nullsafety.1"
105105
path_drawing:
106106
dependency: transitive
107107
description:
@@ -134,56 +134,56 @@ packages:
134134
name: source_span
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.7.0"
137+
version: "1.8.0-nullsafety.2"
138138
stack_trace:
139139
dependency: transitive
140140
description:
141141
name: stack_trace
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "1.9.5"
144+
version: "1.10.0-nullsafety.1"
145145
stream_channel:
146146
dependency: transitive
147147
description:
148148
name: stream_channel
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "2.0.0"
151+
version: "2.1.0-nullsafety.1"
152152
string_scanner:
153153
dependency: transitive
154154
description:
155155
name: string_scanner
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "1.0.5"
158+
version: "1.1.0-nullsafety.1"
159159
term_glyph:
160160
dependency: transitive
161161
description:
162162
name: term_glyph
163163
url: "https://pub.dartlang.org"
164164
source: hosted
165-
version: "1.1.0"
165+
version: "1.2.0-nullsafety.1"
166166
test_api:
167167
dependency: transitive
168168
description:
169169
name: test_api
170170
url: "https://pub.dartlang.org"
171171
source: hosted
172-
version: "0.2.17"
172+
version: "0.2.19-nullsafety.2"
173173
typed_data:
174174
dependency: transitive
175175
description:
176176
name: typed_data
177177
url: "https://pub.dartlang.org"
178178
source: hosted
179-
version: "1.2.0"
179+
version: "1.3.0-nullsafety.3"
180180
vector_math:
181181
dependency: transitive
182182
description:
183183
name: vector_math
184184
url: "https://pub.dartlang.org"
185185
source: hosted
186-
version: "2.0.8"
186+
version: "2.1.0-nullsafety.3"
187187
xml:
188188
dependency: transitive
189189
description:
@@ -192,5 +192,5 @@ packages:
192192
source: hosted
193193
version: "4.5.1"
194194
sdks:
195-
dart: ">=2.9.0-14.0.dev <3.0.0"
195+
dart: ">=2.10.0-110 <2.11.0"
196196
flutter: ">=1.18.0-6.0.pre <2.0.0"

0 commit comments

Comments
 (0)