fix(ui): 提升卡片文字对比度与辅助信息可读性

This commit is contained in:
2026-11-15 19:51:47 +08:00
parent 60c146f8b7
commit 9088f8a251
14 changed files with 179 additions and 79 deletions
+23 -13
View File
@@ -7,26 +7,36 @@ struct MemoryDetailsView: View {
var body: some View {
VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 3) {
ForEach(0..<3) { index in
if index > 0 { Text("·").foregroundStyle(.secondary) }
HStack(spacing: 2) {
Text(labels[index])
MetricText(value: String(format: "%.1f", Double(values[index]) / 1_073_741_824))
}
.help(Text(MetricFormat.memory(values[index])))
ViewThatFits(in: .horizontal) {
classification(0..<3, unit: true).fixedSize(horizontal: true, vertical: true)
VStack(alignment: .leading, spacing: 4) {
classification(0..<2, unit: false)
classification(2..<3, unit: true)
}
Text(verbatim: "GiB")
}
.font(.system(size: 8)).foregroundStyle(.secondary)
.lineLimit(1).minimumScaleFactor(0.75)
HStack(spacing: 4) {
Text("memory.available").foregroundStyle(.secondary)
MetricText(value: MetricFormat.memory(memory.available))
}.font(.system(size: 9)).lineLimit(1)
MetricText(value: MetricFormat.memory(memory.available)).fontWeight(.medium)
}.frame(height: 16)
}
.font(.system(size: 10)).lineLimit(1)
.help(Text("memory.distributionHelp"))
.accessibilityElement(children: .contain)
.accessibilityLabel(Text("memory.distribution"))
}
private func classification(_ indices: Range<Int>, unit: Bool) -> some View {
HStack(spacing: 4) {
ForEach(Array(indices), id: \.self) { index in
if index > indices.lowerBound { Text("·").foregroundStyle(.secondary) }
HStack(spacing: 3) {
Text(labels[index]).foregroundStyle(.secondary)
MetricText(value: String(format: "%.1f", Double(values[index]) / 1_073_741_824))
.fontWeight(.medium).foregroundStyle(.primary)
}
.help(Text(MetricFormat.memory(values[index])))
}
if unit { Text(verbatim: "GiB").foregroundStyle(.secondary) }
}.frame(height: 16)
}
}