Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  MyCapsulesPickerView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/27/22.
6
//
7
 
8
import SwiftUI
9
 
10
enum CapsulePickerType : String
11
{
12
    case pending
13
    case inprogress
14
    case completed
15
}
16
 
17
 
18
struct MyCapsulesPickerView : View {
19
    @Binding var selectedType: CapsulePickerType
20
 
21
 
22
 
23
    var body : some View {
24
 
25
        GeometryReader { geometry in
26
            VStack {
27
 
28
                HStack {
29
                    Spacer()
30
                    Button(action: {
31
                        self.selectedType = .pending
32
                    }, label: {
33
                        //VStack(spacing: 0) {
34
                            if  self.selectedType == .pending {
35
 
36
                                Text(Config.LANG_PICKER_PENDING)
37
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
38
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
39
                                .tag(0)
40
                                .padding(.top, 8)
41
                                .padding(.leading, 5)
42
                                .padding(.trailing, 5)
43
                                .padding(.bottom, 8)
44
                                .overlay(
45
                                    Rectangle()
46
                                    .frame(height: 2)
47
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
48
                                , alignment: .bottom)
49
                            } else {
50
                                Text(Config.LANG_PICKER_PENDING)
51
                                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
52
                                    .foregroundColor(Color("color_picker_foreground"))
53
                                .tag(0)
54
                                .padding(.top, 8)
55
                                .padding(.leading, 5)
56
                                .padding(.trailing, 5)
57
                                .padding(.bottom, 8)
58
                            }
59
 
60
                           // Spacer()
61
                        //}
62
                    })
63
 
64
 
65
                    Spacer()
66
                    Button(action: {
67
                        self.selectedType = .inprogress
68
                    }, label: {
69
                       // VStack(spacing: 0) {
70
                            if  self.selectedType == .inprogress {
71
 
72
                                Text(Config.LANG_PICKER_IN_PROGRESS)
73
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
74
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
75
                                .tag(1)
76
                                .padding(.top, 8)
77
                                .padding(.leading, 5)
78
                                .padding(.trailing, 5)
79
                                .padding(.bottom, 8)
80
                                .overlay(
81
                                    Rectangle()
82
                                    .frame(height: 2)
83
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
84
                                , alignment: .bottom)
85
                            } else {
86
                                Text(Config.LANG_PICKER_IN_PROGRESS)
87
                                 .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
88
                                    .foregroundColor(Color("color_picker_foreground"))
89
                                .tag(1)
90
                                .padding(.top, 8)
91
                                .padding(.leading, 5)
92
                                .padding(.trailing, 5)
93
                                .padding(.bottom, 8)
94
 
95
                            }
96
                            //Spacer()
97
                        //}
98
                    })
99
 
100
                    Spacer()
101
                    Button(action: {
102
                        self.selectedType = .completed
103
                    }, label: {
104
                        //VStack(spacing: 0) {
105
                            if( self.selectedType == .completed) {
106
 
107
                                Text(Config.LANG_PICKER_FINISHED).tag(2)
108
                                .font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
109
                                    .foregroundColor(Color("color_picker_foreground_highlight"))
110
                                .padding(.top, 8)
111
                                .padding(.leading, 5)
112
                                .padding(.trailing, 5)
113
                                .padding(.bottom, 8)
114
                                .overlay(
115
                                    Rectangle()
116
                                    .frame(height: 2)
117
                                    .foregroundColor(Color("color_picker_overlay_highlight"))
118
                                , alignment: .bottom)
119
                            } else {
120
                                Text(Config.LANG_PICKER_FINISHED).tag(2)
121
                                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
122
                                    .foregroundColor(Color("color_picker_foreground"))
123
                                .padding(.top, 8)
124
                                .padding(.leading, 5)
125
                                .padding(.trailing, 5)
126
                                .padding(.bottom, 8)
127
 
128
                            }
129
                            //Spacer()
130
                        //}
131
                    })
132
                    Spacer()
133
                }
134
 
135
 
136
 
137
 
138
            }
139
            .frame(height: 48)
140
            .background(Color("color_picker_background"))
141
 
142
 
143
        }
144
 
145
    }
146
}
147
 
148
 
149
 
150
 
151
struct MyCapsulesPickerView_Previews: PreviewProvider {
152
    @State static var selectedType: CapsulePickerType = .pending
153
 
154
 
155
    static var previews: some View {
156
        MyCapsulesPickerView(selectedType: self.$selectedType)
157
    }
158
}