DFStatusOrb.swift
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// DFStatusOrb.swift
// hippo-watch-extension
//
import SwiftUI
struct DFStatusOrb: View {
let status: DFStressStatus
let value: String
var body: some View {
ZStack {
Circle()
.fill(status.color.opacity(0.16))
Circle()
.stroke(status.color.opacity(0.34), lineWidth: 5)
Circle()
.trim(from: 0.12, to: 0.82)
.stroke(status.color, style: StrokeStyle(lineWidth: 5, lineCap: .round))
.rotationEffect(.degrees(110))
if value.isEmpty {
Image(systemName: "heart.text.square.fill")
.font(.system(size: 12, weight: .semibold))
.foregroundStyle(status.color)
} else {
VStack(spacing: -1) {
Text(value)
.font(.system(size: 14, weight: .bold, design: .rounded))
.foregroundStyle(.white)
Text("ms")
.font(.system(size: 7, weight: .medium))
.foregroundStyle(.white.opacity(0.74))
}
}
}
}
}