1 |
efrain |
1 |
//
|
|
|
2 |
// UserExtendedPointView.swift
|
|
|
3 |
// twogetskills
|
|
|
4 |
//
|
|
|
5 |
// Created by Efrain Yanez Recanatini on 5/6/22.
|
|
|
6 |
//
|
|
|
7 |
|
|
|
8 |
import Foundation
|
|
|
9 |
import SwiftUI
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
struct UserExtendedPointView : View {
|
|
|
15 |
|
|
|
16 |
let userExtendedPoint: UserExtendedPoint
|
|
|
17 |
|
|
|
18 |
init (userExtendedPoint: UserExtendedPoint)
|
|
|
19 |
{
|
|
|
20 |
self.userExtendedPoint = userExtendedPoint
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
/*
|
|
|
25 |
|
|
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
var body: some View {
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
GeometryReader { geometry in
|
|
|
33 |
|
|
|
34 |
let posXCircle = (10 + (geometry.size.width / 2)) - geometry.size.width
|
|
|
35 |
|
|
|
36 |
let posYCircle = (geometry.size.height / 2)
|
|
|
37 |
|
|
|
38 |
let posXLine = (10 + (geometry.size.width / 2)) - geometry.size.width
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
ZStack {
|
|
|
44 |
Circle().frame(width: 10, height: 10, alignment: .topTrailing)
|
|
|
45 |
.foregroundColor(Color("color_profile_list_item_foreground_indicator"))
|
|
|
46 |
.offset(x: posXCircle, y: posYCircle)
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
Rectangle().frame(width:5, height: geometry.size.height)
|
|
|
51 |
.foregroundColor(Color("color_profile_list_item_foreground_indicator"))
|
|
|
52 |
.offset(x: posXLine, y: 0)
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
HStack{
|
|
|
56 |
|
|
|
57 |
VStack(alignment: .leading, spacing: 8) {
|
|
|
58 |
Text(self.userExtendedPoint.label)
|
|
|
59 |
.bold()
|
|
|
60 |
.font(.callout)
|
|
|
61 |
.lineLimit(1).foregroundColor(Color(self.userExtendedPoint.type == .company ? "color_profile_list_item_foreground_highlight" : "color_profile_list_item_foreground")
|
|
|
62 |
)
|
|
|
63 |
|
|
|
64 |
Text(self.userExtendedPoint.value)
|
|
|
65 |
.font(.caption2)
|
|
|
66 |
.foregroundColor(Color(self.userExtendedPoint.type == .company ? "color_profile_list_item_foreground_highlight" : "color_profile_list_item_foreground")
|
|
|
67 |
)
|
|
|
68 |
|
|
|
69 |
}.padding(.leading, 25)
|
|
|
70 |
|
|
|
71 |
Spacer()
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
}.background(Color(self.userExtendedPoint.type == .company ? "color_profile_list_item_background_highlight" : "color_profile_list_item_background")
|
|
|
82 |
)
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
struct UserExtendedPointView_Previews: PreviewProvider {
|
|
|
90 |
static var previews: some View {
|
|
|
91 |
let userExtendedPoint = UserExtendedPoint(type: .company, label: "Company1", value : "Value1")
|
|
|
92 |
|
|
|
93 |
UserExtendedPointView(userExtendedPoint : userExtendedPoint )
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
|