Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Rev 1 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

//
//  CommentAndRatingImageView.swift
//  twogetskills
//
//  Created by Efrain Yanez Recanatini on 7/28/22.
//

import SwiftUI

struct CommentAndRatingImageView: View {
    
    var capsuleModel : CapsuleModel
    
    
    var body: some View {
       
            Group {
                HStack {
                    Spacer()
                    
                    Group {
                    
                        if self.capsuleModel.image.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
                        
                        
                        Image(uiImage: UIImage(named: "logo") ?? UIImage())
                            .resizable()
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                               
                           
                        
                    } else {
                        CustomAsyncImage(
                            url: URL(string: self.capsuleModel.image.trimmingCharacters(in: .whitespacesAndNewlines))!,
                            placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},
                            image: {
                                Image(uiImage: $0).resizable()
                              
                                       
                            }
                        )
                    }
                    }.background(Color("color_window_background"))
                        .frame(width: 93, height: 140, alignment: .center)
                    
                    Spacer()
                }
            }
            .background(Color("color_capsule_comment_rating_image_background"))
            .cornerRadius(8)
            .overlay(
                RoundedRectangle(cornerRadius: 8)
                    .stroke(Color("color_capsule_comment_rating_image_border"), lineWidth:1)
            )
            .shadow(color: Color("color_capsule_comment_rating_image_shadow"), radius:4, x: 5, y: 5)
            . frame(width: UIScreen.main.bounds.width - 40, height: 151)
   
    }
}

struct CommentAndRatingImageView_Previews: PreviewProvider {
    static var capsuleModel = CapsuleModel()
    
    static var previews: some View {
        CommentAndRatingImageView(capsuleModel: capsuleModel)
    }
}