Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 1 | Rev 11 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 8
Línea 6... Línea 6...
6
//
6
//
Línea 7... Línea 7...
7
 
7
 
Línea -... Línea 8...
-
 
8
import SwiftUI
8
import SwiftUI
9
 
9
 
-
 
10
 
-
 
11
struct CommentAndRatingPostCommentView: View {
-
 
Línea -... Línea 10...
-
 
10
 
-
 
11
 
-
 
12
struct CommentAndRatingPostCommentView: View {
12
    
13
 
13
    @Binding var comment: String
-
 
14
    @State var rating : Double = 3
14
    var capsuleModel : CapsuleModel
15
 
-
 
16
    
15
    @Binding var comment : String
17
    
16
    @Binding var rating : Double
18
    var body: some View {
17
 
19
        
18
    var body: some View {
20
            VStack(spacing: 0) {
19
        VStack(spacing: 0) {
21
                HStack {
20
                HStack {
Línea 33... Línea 32...
33
                    
32
                    
34
                } .padding(.leading, 16)
33
                } .padding(.leading, 16)
35
                .padding(.trailing, 16)
34
                .padding(.trailing, 16)
Línea 36... Línea 35...
36
                .padding(.top, comment.isEmpty ? 10 : 2)
35
                .padding(.top, comment.isEmpty ? 10 : 2)
37
                
36
                
38
                if  comment.isEmpty {
37
            if   !capsuleModel.linkComments.trimingLeadingSpaces().isEmpty && comment.trimingLeadingSpaces().isEmpty {
Línea 39... Línea 38...
39
                    HStack {
38
                    HStack {
40
                        Spacer()
39
                        Spacer()
Línea 71... Línea 70...
71
                
70
                
72
                HStack {
71
                HStack {
73
                    Spacer() 
72
                    Spacer() 
Línea 74... Línea -...
74
                    Button(action: {
-
 
75
                       
-
 
76
                        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
-
 
77
                                withAnimation {
-
 
78
                                    
73
                    Button(action: {
Línea 79... Línea 74...
79
                                }
74
                       
80
                            }
75
                        send()
81
                        
76
                        
82
                    }, label: {
77
                    }, label: {
Línea 94... Línea 89...
94
                }                  .padding(.top, 16)
89
                }                  .padding(.top, 16)
95
                .padding(.leading, 16)
90
                .padding(.leading, 16)
96
                .padding(.trailing, 16)
91
                .padding(.trailing, 16)
Línea 97... Línea 92...
97
                
92
                
-
 
93
                Spacer()
-
 
94
        }.background(Color("color_picker_background"))
98
                Spacer()
95
       
99
            }
96
    }
-
 
97
    
-
 
98
    func send()
-
 
99
    {
-
 
100
        if comment.trimingLeadingSpaces().isEmpty {
-
 
101
            return
Línea 100... Línea 102...
100
            
102
        }
-
 
103
 
-
 
104
        
101
 
105
        print("Notification: \(Constants.NOTIFICATION_NAME_COMMAND_POST_COMMENT) ")
-
 
106
        
-
 
107
        NotificationCenter.default.post(
-
 
108
            name:Constants.NOTIFICATION_NAME_COMMAND_POST_COMMENT,
102
            
109
            object: nil,
-
 
110
            userInfo: nil)
-
 
111
    }
-
 
112
        
-
 
113
       
103
       .background(Color("color_picker_background"))
114
        
Línea 104... Línea 115...
104
    }
115
   
Línea 105... Línea 116...
105
}
116
}
-
 
117
 
-
 
118
struct CommentAndRatingPostCommentView_Previews: PreviewProvider {
106
 
119
    
107
struct CommentAndRatingPostCommentView_Previews: PreviewProvider {
-
 
Línea 108... Línea 120...
108
    
120
    @State static var comment : String = ""
109
    @State static var comment : String = "Welcome to SwiftlyRush's bank, you will be able to access your accounts in this application"
121
    @State static var rating : Double = 3.6
110
    
122
    static let capsuleModel = CapsuleModel()
111
    @State static var isValidComment : Bool = false
123