feat(menubar): 调整两排卡片布局并加入复合曲线与数值动效

This commit is contained in:
2026-11-03 10:10:44 +08:00
parent 0e8f598fe6
commit 906293b7c1
22 changed files with 400 additions and 122 deletions
+13 -9
View File
@@ -10,21 +10,25 @@ struct ResourceCard<Content: View>: View {
var body: some View {
VStack(alignment: .leading, spacing: 4) {
Label { Text(title).foregroundStyle(.primary) } icon: {
Image(systemName: symbol).foregroundStyle(color)
}.font(.system(size: 13, weight: .semibold))
HStack(alignment: .firstTextBaseline) {
Text(verbatim: value).font(.system(size: 27, weight: .semibold, design: .rounded))
.foregroundStyle(color).monospacedDigit().lineLimit(1).minimumScaleFactor(0.8)
Spacer(minLength: 4)
if let secondaryValue { Text(verbatim: secondaryValue).font(.system(size: 15, weight: .semibold)).foregroundStyle(color).lineLimit(1) }
HStack(alignment: .firstTextBaseline, spacing: 6) {
Label { Text(title).foregroundStyle(.primary) } icon: {
Image(systemName: symbol).foregroundStyle(color)
}.font(.system(size: 13, weight: .semibold)).fixedSize()
Spacer(minLength: 0)
VStack(alignment: .trailing, spacing: 0) {
AnimatedMetricText(value: value)
.font(.system(size: 20, weight: .semibold, design: .rounded))
if let secondaryValue {
AnimatedMetricText(value: secondaryValue).font(.system(size: 11, weight: .semibold))
}
}.foregroundStyle(color).lineLimit(1).minimumScaleFactor(0.65)
}
content()
}
.font(.system(size: 11))
.padding(10)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.background(Color("PanelCard"), in: .rect(cornerRadius: 10))
.modifier(PanelCardBackground(radius: 10))
.overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(.primary.opacity(0.14)))
}
}