Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  FinishCapsuleView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 1/28/22.
6
//
7
 
8
import SwiftUI
9
 
10
struct FinishCapsuleView: View {
11
    private let colorTitle = Color( UIColor(hex: Config.COLOR_TEXT_VIEW_TITLE)  ?? .systemBlue);
12
 
13
    private let colorButtonIntroBackground = Color(UIColor(hex: Config.COLOR_BUTTON_INTRO_BACKGROUND) ?? .white);
14
 
15
    @State private var goToCapsules : Bool = false
16
 
17
    private let capsuleModel : CapsuleModel
18
    private let topicModel : TopicModel
19
 
20
    init(capsuleUuid : String)
21
    {
22
        let capsuleDao = CapsuleDao()
23
        capsuleModel = capsuleDao.selectByUuid(uuid: capsuleUuid)
24
 
25
        let topicDao = TopicDao()
26
        topicModel = topicDao.selectByUuid(uuid: capsuleModel.topicUuid)
27
    }
28
 
29
 
30
 
31
    var body: some View {
32
        VStack {
33
            NavigationLink("", destination: GridCapsuleView(topicUuid: self.topicModel.uuid), isActive: self.$goToCapsules).frame( height: 0)
34
 
35
            Text("100%").fontWeight(    .bold)
36
                .font(.system(size: 34.0))
37
                .foregroundColor(colorTitle)
38
 
39
            Text("Felicidades has terminado una Cápsula")
40
                .fontWeight(    .bold)
41
                .font(.system(size: 14.0))
42
                .foregroundColor(colorTitle )
43
                .padding(.top, 1)
44
 
45
 
46
            Button(action: {
47
                let dataService = DataService()
48
                dataService.completeCapsule(topicModel: topicModel, capsuleModel: capsuleModel)
49
 
50
                self.goToCapsules = true
51
 
52
            }, label: {
53
                Text("CONTINUAR")
54
                    .padding(.horizontal, 40.0)
55
                    .padding(.vertical, 12.0)
56
                    .foregroundColor(.white)
57
                    .background(colorButtonIntroBackground)
58
                    .cornerRadius(10)
59
            })
60
            .padding(.top, 30)
61
        }.background(Color(.white))
62
        .navigationBarBackButtonHidden(true)
63
        .navigationBarHidden(true)
64
 
65
    }
66
}
67
 
68
struct FinishCapsuleView_Previews: PreviewProvider {
69
    static var previews: some View {
70
        FinishCapsuleView(capsuleUuid: "C123")
71
    }
72
}