-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfruit.dart
148 lines (110 loc) · 3.72 KB
/
fruit.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import 'package:flutter/material.dart';
import 'Veg_newPage.dart';
class Fruit extends StatefulWidget {
@override
_FruitState createState() => _FruitState();
}
class _FruitState extends State<Fruit> {
@override
var product_list_fruit=[
{
"name" : "Apple",
"pic":Image.network("https://5.imimg.com/data5/LM/DU/MY-22954806/apple-fruit-500x500.jpg"),
"price":"Rs 90/kg",
},
{
"name" : "Strawberry",
"pic":Image.network("https://globalplantgenetics.com/cms/resources/strawberries-1.jpg"),
"price":"Rs 150/kg",
},
{
"name" : "Banana",
"pic":Image.network("https://images-na.ssl-images-amazon.com/images/I/61fZ%2BYAYGaL._SL1500_.jpg"),
"price":"Rs 80/kg",
},
{
"name" : "Watermelon",
"pic":Image.network("https://cdn.britannica.com/99/143599-050-C3289491/Watermelon.jpg"),
"price":"Rs 200",
},
{
"name" : "Melon",
"pic":Image.network("https://deluxeproduce.com/wp-content/uploads/2017/06/canary-melon.jpg"),
"price":"Rs 200",
},
{
"name" : "Mango",
"pic":Image.network("https://www.samaa.tv/wp-content/uploads/2016/07/1-4.jpg"),
"price":"Rs 200/kg",
},
{
"name" : "Grapes",
"pic":Image.network("https://images-na.ssl-images-amazon.com/images/I/61-UMTbWTZL._SY741_.jpg"),
"price":"Rs 100/kg",
},
{
"name" : "Oranges",
"pic":Image.network("https://s.alicdn.com/@sc01/kf/Uef168baa579746c2b9c1533101b48deac/Good-quality-Orange-Fruit-Wholesale-Valencia-Navel.jpg_300x300.jpg"),
"price":"Rs 120/kg",
},
{
"name" : "Grewia",
"pic":Image.network("https://3.bp.blogspot.com/_kmRrEaE-evw/TAD6sp6mCII/AAAAAAAADME/-hO4M3pzyu8/s1600/DSCN0474.jpg"),
"price":"Rs 100/kg",
},
];
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar:AppBar(
title:Text('Fruits'),backgroundColor:Colors.lightGreen,
actions: <Widget>[new IconButton(icon: Icon(Icons.shopping_cart),color:Colors.pink,
onPressed:(){Navigator.pushNamed(context,'/cart');},
)], ),
body:(
InkWell(
onTap: (){
},
child: GridView.builder(itemCount: product_list_fruit.length,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
itemBuilder: (BuildContext context, int index) {
return Fruits_Details
(
pro_name: product_list_fruit[index]['name'],
pro_pic: product_list_fruit[index]['pic'],
pro_price: product_list_fruit[index]['price'],
);
}
),)
),
);
}
}
class Fruits_Details extends StatelessWidget {
final pro_name;
final pro_pic ;
final pro_price;
Fruits_Details({this.pro_name,this.pro_pic,this.pro_price});
var cart=[];
@override
Widget build(BuildContext context) {
return Card(
child:InkWell(
onTap: () {
Navigator.of(context).push(new MaterialPageRoute(builder: (context) => new Veg_newPage(product:pro_name, price:pro_price, pic:pro_pic,)));
},
child: GridTile(
footer:Container(
color:Colors.white,
child:ListTile(
leading: Text(pro_name,style: TextStyle(fontWeight:FontWeight.bold),),
title:Text(pro_price,style: TextStyle(color:Colors.red,),),
),
),
child:pro_pic,
),
),
);
}
}