-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathDealsOfTheDay.dart
More file actions
159 lines (153 loc) · 4.98 KB
/
DealsOfTheDay.dart
File metadata and controls
159 lines (153 loc) · 4.98 KB
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
149
150
151
152
153
154
155
156
157
158
159
import 'package:flipkart_flutter_ui/src/Models/deals.dart';
import 'package:flutter/material.dart';
class Fourthlist extends StatefulWidget {
@override
_FourthlistState createState() => _FourthlistState();
}
class _FourthlistState extends State<Fourthlist> {
List<deals> deal;
@override
void initState() {
super.initState();
addDealItem();
}
addDealItem() {
deal = <deals>[];
deal.add(deals(
"assets/female.png",
'Dresses & Tops',
'From 99'));
deal.add(deals(
"assets/watch.png",
'Watches',
'Upto 70% Off'));
deal.add(deals(
"assets/male_modle.png",
'T Shirts',
'Starting @99'));
deal.add(deals(
"assets/shirt_modle.png",
'Casual Shirts',
'Extra 100 Off'));
}
buildItem(BuildContext context, int index) {
return Container(
height: MediaQuery.of(context).size.height / 3.5,
child: Column(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height / 6.5,
width: MediaQuery.of(context).size.width / 4,
child: Image.asset(deal[index].imageUrl),
),
Text(
'${deal[index].name}',
style: TextStyle(fontSize: 15),
),
Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(
'${deal[index].discount}',
style: TextStyle(color: Colors.green),
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
return Container(
height: size.height / 1.6,
child: Stack(
children: <Widget>[
Container(
height: size.height / 1.7,
color: Color(0xffFFBAF0),
),
Container(
height: size.height / 7,
width: size.width,
alignment: Alignment.topCenter,
child: Image.asset(
"assets/banner_three.png",
),
),
Positioned(
top: MediaQuery.of(context).size.height / 65,
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Deals of the Day',
style: TextStyle(color: Colors.white, fontSize: 20),
),
Row(
children: <Widget>[
Icon(
Icons.access_time,
color: Colors.white,
),
Text(
'19h 18m Remaining',
style: TextStyle(
color: Colors.white, fontSize: 10),
)
],
)
],
),
Padding(
padding: const EdgeInsets.only(right: 8),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('View All'),
),
),
)
],
),
width: size.width,
),
Container(
height: size.height / 1.75,
padding: EdgeInsets.only(left: 8, right: 8),
width: size.width,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
color: Colors.white,
child: GridView.builder(
padding: EdgeInsets.all(10),
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return buildItem(context, index);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
),
),
)
],
),
)
],
),
);
}
}