Rev 9 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
//// ProfileView.swift// twogetskills//// Created by Efrain Yanez Recanatini on 5/4/22.//import Foundationimport Foundationimport SwiftUIstruct ProfileView: View {@Environment(\.presentationMode)var presentationMode: Bindingprivate var userExtendedPointViewModel : UserExtendedPointViewModel = UserExtendedPointViewModel()private let appData = AppData.sharedInstancevar body: some View {GeometryReader { geometry inVStack(spacing: 0) {HStack {Image("logo").resizable().frame(width: 32, height: 32, alignment: .center).aspectRatio(contentMode: .fit).foregroundColor(Color("color_app_bar_foreground")).padding(.leading, 16)Text(Config.LANG_TAB_BAR_BUTTON_PROFILE).font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_APP_BAR_HEAD1 )).foregroundColor(Color("color_app_bar_foreground")).padding(.leading, 4)Spacer()}.background(Color("color_app_bar_background")).edgesIgnoringSafeArea(.top).frame(height: 50)Divider()ZStack(alignment: .top) {Rectangle().foregroundColor(Color("color_app_bar_background")).edgesIgnoringSafeArea(.top).frame(height: 70)HStack {if appData.image.isEmpty {Image("logo").resizable().aspectRatio(contentMode: .fit).frame(height: Config.PROFILE_IMAGE_SIZE).clipShape(Circle()).overlay(Circle().stroke(Color.white, lineWidth: 4)).shadow(radius: 10)} else {CustomAsyncImageProfile(url: URL(string: appData.image)!,placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},image: {Image(uiImage: $0).resizable()})}}.padding(10)}VStack(spacing: 5) {VStack(spacing: 5) {Text("\(appData.firstName) \(appData.lastName)" ).bold().font(.title)Text("\(appData.email)").font(.body).foregroundColor(Color("color_texview"))}.padding()}.background(Color("color_card_view_background"))ScrollView {ForEach(0..<self.userExtendedPointViewModel.points.count) { i inUserExtendedPointView(userExtendedPoint: self.userExtendedPointViewModel.points[i]).listRowInsets(.init()).frame(width: geometry.size.width, height: 70, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)}}//.listStyle(InsetListStyle()).background(Color("color_card_view_background"))//Spacer()}.onAppear {userExtendedPointViewModel.loadAll()}.navigationTitle("Perfil").navigationBarBackButtonHidden(true).navigationBarTitleDisplayMode(.inline).navigationBarItems(trailing:Button(action: {print("Dismissing sheet view...")}, label: {HStack {Image(systemName: "arrow.clockwise").aspectRatio(contentMode: .fit)//.foregroundColor(Color("color_app_bar_foreground"))//.background(Color("color_app_bar_background"))}}))}}}struct ProfileView_Previews: PreviewProvider {static var previews: some View {ProfileView()}}