Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  CommentAndRatingPickerView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/28/22.
6
//
7
 
8
import SwiftUI
9
 
10
enum CommentAndRatingPickerType : String
11
{
12
    case introduction
13
    case comments
14
    case postcomment
15
}
16
 
17
 
18
struct CommentAndRatingPickerView : View {
19
    @Binding var selectedType: CommentAndRatingPickerType
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 = .introduction
32
                    }, label: {
33
                        //VStack(spacing: 0) {
34
                        if  self.selectedType == .introduction {
35
 
36
                                Text(Config.LANG_PICKER_INTRODUCTION)
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_INTRODUCTION)
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 = .comments
68
                    }, label: {
69
                       // VStack(spacing: 0) {
70
                            if  self.selectedType == .comments {
71
 
72
                                Text(Config.LANG_PICKER_COMMENTS)
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_COMMENTS)
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 = .postcomment
103
                    }, label: {
104
                        //VStack(spacing: 0) {
105
                            if( self.selectedType == .postcomment) {
106
 
107
                                Text(Config.LANG_PICKER_POST_COMMENT).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_POST_COMMENT).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
struct CommentAndRatingPickerView_Previews: PreviewProvider {
147
    @State static var selectedType: CommentAndRatingPickerType = .introduction
148
 
149
    static var previews: some View {
150
        CommentAndRatingPickerView(selectedType: self.$selectedType)
151
    }
152
}