Няма описание

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // FoodCardView.swift
  3. // Comedores Sociales
  4. //
  5. // Created by Hector Carrion on 11/30/20.
  6. //
  7. import SwiftUI
  8. struct FoodCardView: View {
  9. var item: FoodItem
  10. @State var show = false
  11. var body: some View {
  12. HStack(spacing: 15){
  13. Image(item.name)
  14. .resizable()
  15. .frame(width: 65, height: 65)
  16. VStack{
  17. HStack{
  18. VStack(alignment: .leading, spacing: 5) {
  19. Text(NSLocalizedString(item.name, comment:""))
  20. .font(.title2)
  21. Text(item.cuantity)
  22. .font(.caption)
  23. .foregroundColor(.gray)
  24. }
  25. Spacer(minLength: 10)
  26. VStack{
  27. Button(action: {show.toggle()}) {
  28. Text(show ? NSLocalizedString("added", comment:"") : "$" + String(item.priceLocal))
  29. .fontWeight(.heavy)
  30. .padding(.vertical,8)
  31. .padding(.horizontal,20)
  32. .background(Color.primary.opacity(0.1))
  33. .clipShape(Capsule())
  34. }
  35. Text(NSLocalizedString("savings", comment:"") + String(item.savings))
  36. .font(.caption2)
  37. .foregroundColor(.green)
  38. }
  39. }
  40. Divider()
  41. }
  42. }
  43. .padding(.horizontal)
  44. }
  45. }