Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Autoría | Ultima modificación | Ver Log |

//
//  MyCapsulesPickerView.swift
//  twogetskills
//
//  Created by Efrain Yanez Recanatini on 7/27/22.
//

import SwiftUI

enum CapsulePickerType : String
{
    case pending
    case inprogress
    case completed
}


struct MyCapsulesPickerView : View {
    @Binding var selectedType: CapsulePickerType
   
    
    
    var body : some View {
 
        GeometryReader { geometry in
            VStack {
                
                HStack {
                    Spacer()
                    Button(action: {
                        self.selectedType = .pending
                    }, label: {
                        //VStack(spacing: 0) {
                            if  self.selectedType == .pending {
                            
                                Text(Config.LANG_PICKER_PENDING)
                                .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_PENDING)
                                .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 = .inprogress
                    }, label: {
                       // VStack(spacing: 0) {
                            if  self.selectedType == .inprogress {
                            
                                Text(Config.LANG_PICKER_IN_PROGRESS)
                                .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_IN_PROGRESS)
                                 .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 = .completed
                    }, label: {
                        //VStack(spacing: 0) {
                            if( self.selectedType == .completed) {
                            
                                Text(Config.LANG_PICKER_FINISHED).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_FINISHED).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 MyCapsulesPickerView_Previews: PreviewProvider {
    @State static var selectedType: CapsulePickerType = .pending
    
    
    static var previews: some View {
        MyCapsulesPickerView(selectedType: self.$selectedType)
    }
}