fix(ui): 缩小卡片并还原设计稿紧凑排布

This commit is contained in:
2026-11-15 17:14:42 +08:00
parent 3c1a2baace
commit d87aa3ccc5
29 changed files with 609 additions and 272 deletions
+5 -3
View File
@@ -4,17 +4,19 @@ import SwiftUI
struct MetricProgressBar: View {
let value: Double
let color: Color
var cornerRadius: CGFloat? = nil
private var fraction: Double { value.isFinite ? min(1, max(0, value)) : 0 }
var body: some View {
GeometryReader { proxy in
let shape = RoundedRectangle(cornerRadius: cornerRadius ?? proxy.size.height / 2, style: .continuous)
ZStack(alignment: .leading) {
Capsule().fill(color.opacity(0.15))
Capsule().fill(color).frame(width: proxy.size.width * fraction)
shape.fill(color.opacity(0.15))
shape.fill(color).frame(width: proxy.size.width * fraction)
}
.frame(width: proxy.size.width, height: proxy.size.height)
.clipShape(Capsule())
.clipShape(shape)
.transaction { $0.animation = nil; $0.disablesAnimations = true }
}
}