File tree Expand file tree Collapse file tree 1 file changed +49
-3
lines changed
lib/views/wishlist_screen_view Expand file tree Collapse file tree 1 file changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,55 @@ class WishlistScreen extends StatelessWidget {
21
21
if (! snapshot.hasData)
22
22
return loadingIndicator ();
23
23
else if (snapshot.data! .docs.isEmpty)
24
- return "No items yet!" .text.color (darkFontGrey).makeCentered ();
25
- else
26
- return Container ();
24
+ return "Wishlist is Empty" .text.color (darkFontGrey).makeCentered ();
25
+ else {
26
+ var data = snapshot.data! .docs;
27
+ return Column (
28
+ children: [
29
+ Expanded (
30
+ child: ListView .builder (
31
+ itemCount: data.length,
32
+ shrinkWrap: true ,
33
+ itemBuilder: (BuildContext context, int index) => ListTile (
34
+ leading: Image .network (
35
+ "${data [index ]['p_images' ][0 ]}" ,
36
+ width: 80 ,
37
+ fit: BoxFit .cover,
38
+ ),
39
+ title: "${data [index ]['p_name' ]}"
40
+ .text
41
+ .fontFamily (semibold)
42
+ .size (16 )
43
+ .make (),
44
+ subtitle: "${data [index ]['p_price' ]}"
45
+ .numCurrency
46
+ .text
47
+ .fontFamily (semibold)
48
+ .size (16 )
49
+ .color (redColor)
50
+ .make (),
51
+ trailing: IconButton (
52
+ onPressed: () => firestore
53
+ .collection (productsCollection)
54
+ .doc (data[index].id)
55
+ .set (
56
+ {
57
+ 'p_wishlist' :
58
+ FieldValue .arrayRemove ([currentUser! .uid])
59
+ },
60
+ SetOptions (merge: true ),
61
+ ),
62
+ icon: const Icon (
63
+ Icons .favorite_outlined,
64
+ color: redColor,
65
+ ),
66
+ ),
67
+ ),
68
+ ),
69
+ ),
70
+ ],
71
+ );
72
+ }
27
73
},
28
74
),
29
75
);
You can’t perform that action at this time.
0 commit comments