Без опису

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // LogIn.swift
  3. // Comedores Sociales
  4. //
  5. // Created by Hector Carrion on 10/24/20.
  6. //
  7. import SwiftUI
  8. struct LoginView: View {
  9. @State var email: String = ""
  10. @State var password: String = ""
  11. @State var showingRegister: Bool = false
  12. var body: some View {
  13. VStack {
  14. WelcomeImage()
  15. WelcomeText()
  16. TextField("Email", text: $email)
  17. .autocapitalization(.none)
  18. .padding()
  19. .background(lightGreyColor)
  20. .cornerRadius(5.0)
  21. .padding(.bottom, 5)
  22. SecureField("Password", text: $password)
  23. .autocapitalization(.none)
  24. .padding()
  25. .background(lightGreyColor)
  26. .cornerRadius(5.0)
  27. .padding(.bottom, 20)
  28. Button(action: {print("login tapped")}) {
  29. LoginText()
  30. }
  31. Button(action: {self.showingRegister.toggle()}) {
  32. RegisterText()
  33. }.sheet(isPresented: $showingRegister, content: {
  34. RegisterView()
  35. })
  36. }
  37. .padding()
  38. }
  39. }
  40. struct LogInView_Previews: PreviewProvider {
  41. static var previews: some View {
  42. LoginView()
  43. }
  44. }
  45. struct WelcomeText: View {
  46. var body: some View {
  47. Text("Comedores Sociales")
  48. .font(.largeTitle)
  49. .fontWeight(.semibold)
  50. .padding(.bottom, 20)
  51. }
  52. }
  53. struct WelcomeImage: View {
  54. var body: some View {
  55. Image("logInImage")
  56. .resizable()
  57. .aspectRatio(contentMode: .fill)
  58. .frame(width: 150, height: 150)
  59. .clipped()
  60. //.cornerRadius(150)
  61. //.padding(.bottom, 75)
  62. }
  63. }
  64. struct LoginText: View {
  65. var body: some View {
  66. Text("Login")
  67. .font(.headline)
  68. .foregroundColor(.white)
  69. .padding()
  70. .frame(width: 220, height: 50)
  71. .background(Color.blue)
  72. .cornerRadius(5)
  73. .padding(.bottom, 5)
  74. }
  75. }
  76. struct RegisterText: View {
  77. var body: some View {
  78. Text("Don't have an account? Register")
  79. .font(.headline)
  80. .foregroundColor(.gray)
  81. .padding()
  82. .frame(width: 350, height: 50)
  83. .background(Color.clear)
  84. .cornerRadius(5)
  85. }
  86. }