1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //
- // FoodCardView.swift
- // Comedores Sociales
- //
- // Created by Hector Carrion on 11/30/20.
- //
-
- import SwiftUI
-
- struct FoodCardView: View {
-
- var item: FoodItem
- @State var show = false
-
- var body: some View {
-
- HStack(spacing: 15){
-
- Image(item.name)
- .resizable()
- .frame(width: 65, height: 65)
-
- VStack{
-
- HStack{
-
- VStack(alignment: .leading, spacing: 5) {
-
- Text(NSLocalizedString(item.name, comment:""))
- .font(.title2)
-
- Text(item.cuantity)
- .font(.caption)
- .foregroundColor(.gray)
- }
-
- Spacer(minLength: 10)
-
- VStack{
-
- Button(action: {show.toggle()}) {
-
- Text(show ? NSLocalizedString("added", comment:"") : "$" + String(item.priceLocal))
- .fontWeight(.heavy)
- .padding(.vertical,8)
- .padding(.horizontal,20)
- .background(Color.primary.opacity(0.1))
- .clipShape(Capsule())
- }
-
- Text(NSLocalizedString("savings", comment:"") + String(item.savings))
- .font(.caption2)
- .foregroundColor(.green)
- }
- }
-
- Divider()
- }
- }
- .padding(.horizontal)
- }
- }
|