Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

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

import SwiftUI

enum CommentAndRatingPickerType : String
{
    case introduction
    case comments
    case postcomment
}


struct CommentAndRatingPickerView : View {
    @Binding var selectedType: CommentAndRatingPickerType
   
    
    
    var body : some View {
 
        GeometryReader { geometry in
            VStack {
                
                HStack {
                    Spacer()
                    Button(action: {
                        self.selectedType = .introduction
                    }, label: {
                        //VStack(spacing: 0) {
                        if  self.selectedType == .introduction {
                            
                                Text(Config.LANG_PICKER_INTRODUCTION)
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
                                .tag(0)
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                                .overlay(
                                    Rectangle()
                                    .frame(height: 2)
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
                                , alignment: .bottom)
                            } else {
                                Text(Config.LANG_PICKER_INTRODUCTION)
                                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground"))
                                .tag(0)
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                            }
                            
                           // Spacer()
                        //}
                    })
                    
                    
                    Spacer()
                    Button(action: {
                        self.selectedType = .comments
                    }, label: {
                       // VStack(spacing: 0) {
                            if  self.selectedType == .comments {
                            
                                Text(Config.LANG_PICKER_COMMENTS)
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
                                .tag(1)
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                                .overlay(
                                    Rectangle()
                                    .frame(height: 2)
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
                                , alignment: .bottom)
                            } else {
                                Text(Config.LANG_PICKER_COMMENTS)
                                 .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground"))
                                .tag(1)
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                                
                            }
                            //Spacer()
                        //}
                    })
                    
                    Spacer()
                    Button(action: {
                        self.selectedType = .postcomment
                    }, label: {
                        //VStack(spacing: 0) {
                            if( self.selectedType == .postcomment) {
                            
                                Text(Config.LANG_PICKER_POST_COMMENT).tag(2)
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                                .overlay(
                                    Rectangle()
                                    .frame(height: 2)
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
                                , alignment: .bottom)
                            } else {
                                Text(Config.LANG_PICKER_POST_COMMENT).tag(2)
                                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
                                    .foregroundColor(Color("color_picker_foreground"))
                                .padding(.top, 8)
                                .padding(.leading, 5)
                                .padding(.trailing, 5)
                                .padding(.bottom, 8)
                               
                            }
                            //Spacer()
                        //}
                    })
                    Spacer()
                }
            
      
        
       
            }
            .frame(height: 48)
            .background(Color("color_picker_background"))
            
        }

    }
}
struct CommentAndRatingPickerView_Previews: PreviewProvider {
    @State static var selectedType: CommentAndRatingPickerType = .introduction
    
    static var previews: some View {
        CommentAndRatingPickerView(selectedType: self.$selectedType)
    }
}