fix(power): 完善电池卡片的共同供电判定、功率图标与预估续航

按适配器和电池的实际贡献判定共同供电,以双图标和双色柱展示两路功率。同步三语预估续航文案,在仅外接供电时隐藏估时行。
This commit is contained in:
2026-11-16 15:06:02 +08:00
parent ae448bce5c
commit 451d31682d
16 changed files with 262 additions and 147 deletions
+7 -1
View File
@@ -11,6 +11,7 @@ struct ResourceCard<Chart: View, Content: View>: View {
let symbol: String
let color: Color
let value: String
var companionIcon: (symbol: String, color: Color)? = nil
var secondaryValue: String? = nil
var valueColor: Color? = nil
var secondaryValueColor: Color? = nil
@@ -90,7 +91,12 @@ struct ResourceCard<Chart: View, Content: View>: View {
Label {
Text(title).foregroundStyle(statusWarning ? .red : .primary)
} icon: {
Image(systemName: symbol).foregroundStyle(statusWarning ? .red : color)
HStack(spacing: 1) {
Image(systemName: symbol).foregroundStyle(statusWarning ? .red : color)
if let companionIcon {
Image(systemName: companionIcon.symbol).foregroundStyle(companionIcon.color)
}
}
}
.font(.system(size: 11, weight: .semibold)).fixedSize()
if let titleBadge {