[AltWidget] Replaces ProgressRing with SwiftUI.Gauge

This commit is contained in:
Riley Testut
2022-09-14 18:59:44 -07:00
parent e80a49e705
commit ddcc7eee61
3 changed files with 18 additions and 75 deletions

View File

@@ -23,26 +23,27 @@ struct ComplicationView: View
let progress = Double(daysRemaining) / Double(totalDays)
ZStack(alignment: .center) {
ProgressRing(progress: progress) {
if daysRemaining < 0
{
Text("Expired")
.font(.system(size: 10, weight: .bold))
}
else
{
VStack(spacing: -1) {
Text("\(daysRemaining)")
.font(.system(size: 20, weight: .bold, design: .rounded))
Text(daysRemaining == 1 ? "DAY" : "DAYS")
.font(.caption)
}
.offset(y: -1)
Gauge(value: progress) {
if daysRemaining < 0
{
Text("Expired")
.font(.system(size: 10, weight: .bold))
}
else
{
VStack(spacing: -1) {
let fontSize = daysRemaining > 99 ? 18.0 : 20.0
Text("\(daysRemaining)")
.font(.system(size: fontSize, weight: .bold, design: .rounded))
Text(daysRemaining == 1 ? "DAY" : "DAYS")
.font(.caption)
}
.fixedSize()
.offset(y: -1)
}
}
.gaugeStyle(.accessoryCircularCapacity)
.unredacted()
}
}