Vasilis

couponsView changes

1 +{
2 + "images" : [
3 + {
4 + "filename" : "coupons_scrollview.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "coupons_scrollview-1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "coupons_scrollview-2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
...@@ -86,7 +86,6 @@ struct ImageView: View { ...@@ -86,7 +86,6 @@ struct ImageView: View {
86 Image(uiImage: image) 86 Image(uiImage: image)
87 .resizable() 87 .resizable()
88 .aspectRatio(contentMode: .fit) 88 .aspectRatio(contentMode: .fit)
89 -// .frame(width:100, height:100)
90 .onReceive(imageLoader.didChange) { data in 89 .onReceive(imageLoader.didChange) { data in
91 self.image = UIImage(data: data) ?? UIImage() 90 self.image = UIImage(data: data) ?? UIImage()
92 } 91 }
...@@ -106,16 +105,16 @@ extension CouponsView { ...@@ -106,16 +105,16 @@ extension CouponsView {
106 Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) 105 Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
107 .resizable() 106 .resizable()
108 .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02) 107 .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
109 -// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04) 108 + .offset(y: self.uiscreen.height * 0.02)
110 } 109 }
111 } 110 }
112 // .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02) 111 // .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
113 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04) 112 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
114 Text("Όλα τα κουπόνια μου") 113 Text("Όλα τα κουπόνια μου")
115 .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) 114 .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
116 - .offset( y: self.uiscreen.height * 0.04) 115 + .offset( y: self.uiscreen.height * 0.02)
117 } 116 }
118 - .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.12) 117 + .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
119 } 118 }
120 } 119 }
121 120
...@@ -131,42 +130,48 @@ extension CouponsView { ...@@ -131,42 +130,48 @@ extension CouponsView {
131 130
132 var body: some View { 131 var body: some View {
133 132
134 - HStack(alignment: .center) { 133 + VStack(alignment: .leading) {
135 HStack(alignment: .center) { 134 HStack(alignment: .center) {
136 ImageView(withURL: result["img_preview"] as! String) 135 ImageView(withURL: result["img_preview"] as! String)
137 - .frame(maxWidth: self.uiscreen.width * 0.2) 136 + .frame(maxWidth: self.uiscreen.width * 0.15)
138 -// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.05 * 0.96) 137 + .padding(.leading , self.uiscreen.width * 0.04)
139 -// .padding(.leading, self.uiscreen.width * 0.05)
140 Rectangle() 138 Rectangle()
141 .frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93) 139 .frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93)
142 -// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.205, y: -self.uiscreen.height * 0.05 * 0.93) 140 + Spacer()
143 VStack { 141 VStack {
144 Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? "")) 142 Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? ""))
145 - .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading) 143 + .frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: .infinity, alignment: .leading)
144 + .font(.system(size: 18))
146 Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? "")) 145 Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? ""))
147 - .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading) 146 + .frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: self.uiscreen.height * 0.05, alignment: .leading)
147 + .font(.system(size: 53))
148 Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0])) 148 Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0]))
149 - .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading) 149 + .frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: .infinity, alignment: .leading)
150 + .font(.system(size: 13))
150 } 151 }
151 .frame(maxHeight: .infinity) 152 .frame(maxHeight: .infinity)
152 .padding(.top, self.uiscreen.height * 0.03) 153 .padding(.top, self.uiscreen.height * 0.03)
153 .padding(.bottom, self.uiscreen.height * 0.03) 154 .padding(.bottom, self.uiscreen.height * 0.03)
155 + Spacer()
154 VStack { 156 VStack {
155 Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) 157 Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String))
156 - .frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity) 158 + .frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: self.uiscreen.height * 0.10)
159 + .font(.system(size: 13))
157 } 160 }
158 .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity) 161 .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity)
162 + Spacer()
159 163
160 } 164 }
161 - .frame(maxWidth: .infinity, maxHeight: .infinity) 165 + .background(
166 + Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
167 + )
168 + .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13)
169 + .background(Color.purple)
170 +
162 171
163 } 172 }
164 - .background( 173 + .padding(.top, self.uiscreen.height * 0.05)
165 - Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) 174 +
166 - )
167 -// .padding(.top, self.uiscreen.height * 0.05)
168 - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.13)
169 - .background(Color.purple)
170 } 175 }
171 } 176 }
172 177
...@@ -196,23 +201,20 @@ struct CouponsView: View { ...@@ -196,23 +201,20 @@ struct CouponsView: View {
196 VStack { 201 VStack {
197 if (data.count) > 0 { 202 if (data.count) > 0 {
198 ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in 203 ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in
199 - couponView(result: result, index: index) 204 + couponView(result: result, index: index) }
200 - }
201 } 205 }
202 } 206 }
207 + }
208 + .frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 )
209 + .background(
210 + Image("coupons_scrollView", bundle: Bundle(for: MyEmptyClass.self))
211 + )
203 212
204 - }.frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.88 )
205 } 213 }
206 .frame(width:self.uiscreen.width, height:self.uiscreen.height ) 214 .frame(width:self.uiscreen.width, height:self.uiscreen.height )
207 - .background(Color.red)
208 } 215 }
209 } 216 }
210 #endif 217 #endif
211 -//struct ProfileView_Previews: PreviewProvider {
212 -// static var previews: some View {
213 -// ProfileView()
214 -// }
215 -//}
216 218
217 @available(iOS 13.0.0, *) 219 @available(iOS 13.0.0, *)
218 struct Previews_CouponsView_Previews: PreviewProvider { 220 struct Previews_CouponsView_Previews: PreviewProvider {
......