Vasilis

couponsView changes

{
"images" : [
{
"filename" : "coupons_scrollview.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "coupons_scrollview-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "coupons_scrollview-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -86,7 +86,6 @@ struct ImageView: View {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fit)
// .frame(width:100, height:100)
.onReceive(imageLoader.didChange) { data in
self.image = UIImage(data: data) ?? UIImage()
}
......@@ -106,16 +105,16 @@ extension CouponsView {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
.offset(y: self.uiscreen.height * 0.02)
}
}
// .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
Text("Όλα τα κουπόνια μου")
.frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
.offset( y: self.uiscreen.height * 0.04)
.offset( y: self.uiscreen.height * 0.02)
}
.frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.12)
.frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
}
}
......@@ -131,42 +130,48 @@ extension CouponsView {
var body: some View {
HStack(alignment: .center) {
VStack(alignment: .leading) {
HStack(alignment: .center) {
ImageView(withURL: result["img_preview"] as! String)
.frame(maxWidth: self.uiscreen.width * 0.2)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.05 * 0.96)
// .padding(.leading, self.uiscreen.width * 0.05)
.frame(maxWidth: self.uiscreen.width * 0.15)
.padding(.leading , self.uiscreen.width * 0.04)
Rectangle()
.frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.205, y: -self.uiscreen.height * 0.05 * 0.93)
Spacer()
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? ""))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
.frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: .infinity, alignment: .leading)
.font(.system(size: 18))
Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? ""))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
.frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: self.uiscreen.height * 0.05, alignment: .leading)
.font(.system(size: 53))
Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0]))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
.frame(maxWidth: self.uiscreen.width * 0.3, maxHeight: .infinity, alignment: .leading)
.font(.system(size: 13))
}
.frame(maxHeight: .infinity)
.padding(.top, self.uiscreen.height * 0.03)
.padding(.bottom, self.uiscreen.height * 0.03)
Spacer()
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String))
.frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity)
.frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: self.uiscreen.height * 0.10)
.font(.system(size: 13))
}
.frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
Spacer()
}
.background(
Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
)
// .padding(.top, self.uiscreen.height * 0.05)
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.13)
.frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13)
.background(Color.purple)
}
.padding(.top, self.uiscreen.height * 0.05)
}
}
......@@ -196,23 +201,20 @@ struct CouponsView: View {
VStack {
if (data.count) > 0 {
ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in
couponView(result: result, index: index)
couponView(result: result, index: index) }
}
}
}
.frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 )
.background(
Image("coupons_scrollView", bundle: Bundle(for: MyEmptyClass.self))
)
}.frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.88 )
}
.frame(width:self.uiscreen.width, height:self.uiscreen.height )
.background(Color.red)
}
}
#endif
//struct ProfileView_Previews: PreviewProvider {
// static var previews: some View {
// ProfileView()
// }
//}
@available(iOS 13.0.0, *)
struct Previews_CouponsView_Previews: PreviewProvider {
......