Andromida/AndromidaWidget/Views/Components/SmallWidgetView.swift

39 lines
1.3 KiB
Swift

import SwiftUI
import WidgetKit
import Bedrock
struct SmallWidgetView: View {
let entry: WidgetEntry
var body: some View {
VStack(spacing: Design.Spacing.small) {
ZStack {
Circle()
.stroke(Color.white.opacity(0.1), lineWidth: 8)
Circle()
.trim(from: 0, to: entry.completionRate)
.stroke(Color.brandingAccent, style: StrokeStyle(lineWidth: 8, lineCap: .round))
.rotationEffect(.degrees(-90))
VStack(spacing: 0) {
Text("\(Int(entry.completionRate * 100))%")
.styled(.heading, emphasis: .custom(.white))
Text(String(localized: "Today"))
.styled(.caption, emphasis: .custom(.white.opacity(0.7)))
}
}
.frame(width: 80, height: 80)
HStack(spacing: Design.Spacing.xSmall) {
Image(systemName: "flame.fill")
.foregroundColor(Color.brandingAccent)
Text("\(entry.currentStreak) day streak")
.styled(.captionEmphasis, emphasis: .custom(.white))
}
}
.containerBackground(for: .widget) {
Color.brandingPrimary
}
}
}