Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  FinishTopicView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 1/28/22.
6
//
7
 
8
import SwiftUI
9
 
10
struct FinishTopicView: View {
11
    private let colorTitle = UIColor(hex: Config.COLOR_TEXT_VIEW_TITLE);
12
 
13
    private let colorButtonIntroBackground = UIColor(hex: Config.COLOR_BUTTON_INTRO_BACKGROUND);
14
 
15
    @State private var goToMain : 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
    var body: some View {
31
        VStack {
32
            NavigationLink("", destination:MainView(), isActive: self.$goToMain).frame( height: 0)
33
 
34
            Text("100%").fontWeight(    .bold)
35
                .font(.system(size: 34.0))
36
                .foregroundColor(Color(colorTitle ?? .red))
37
 
38
            Text("Felicidades has terminado un Tópico").fontWeight(    .bold)
39
                .font(.system(size: 14.0))
40
                .foregroundColor(Color(colorTitle ?? .red))
41
                .padding(.top, 1)
42
 
43
 
44
                     Button(action: {
45
                        let dataService = DataService()
46
                        dataService.completeTopic(topicModel: topicModel, capsuleModel: capsuleModel)
47
 
48
                        self.goToMain = true
49
 
50
                     }, label: {
51
                         Text("CONTINUAR").padding(.horizontal, 40.0)
52
                             .padding(.vertical, 12.0)
53
                            .foregroundColor(.white)
54
                             .background(Color(colorButtonIntroBackground ?? .red))
55
                             .cornerRadius(10)
56
                     }).padding(.top, 30)
57
        }.background(Color(.white))
58
        .navigationBarBackButtonHidden(true)
59
        .navigationBarHidden(true)
60
    }
61
}
62
 
63
struct FinishTopicView_Previews: PreviewProvider {
64
    static var previews: some View {
65
        FinishTopicView(capsuleUuid: "C123")
66
    }
67
}