better layout of the advanced sections

This commit is contained in:
Stefan Lange-Hegermann
2025-10-28 22:53:37 +01:00
parent a2314585ea
commit 8868368392
2 changed files with 112 additions and 101 deletions

View File

@@ -886,18 +886,6 @@ struct BatteryEditorView: View {
.listRowSeparator(.hidden)
.listRowBackground(Color(.systemBackground))
}
} footer: {
if isAdvancedExpanded {
VStack(alignment: .leading, spacing: 8) {
Text(usableCapacityFooterText)
Text(chargeVoltageHelperText)
Text(cutOffVoltageHelperText)
Text(temperatureRangeHelperText)
}
.font(.caption)
.foregroundStyle(.secondary)
.opacity(advancedEnabled ? 1 : 0.35)
}
}
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets(top: 12, leading: 18, bottom: 12, trailing: 18))
@@ -906,6 +894,7 @@ struct BatteryEditorView: View {
private var advancedControls: some View {
VStack(spacing: 16) {
VStack(alignment: .leading, spacing: 8) {
EditableSliderRow(
title: usableCapacitySliderTitle,
unit: "%",
@@ -932,7 +921,12 @@ struct BatteryEditorView: View {
saveTitle: alertSaveTitle
)
)
Text(usableCapacityFooterText)
.font(.caption)
.foregroundStyle(.secondary)
}
VStack(alignment: .leading, spacing: 8) {
EditableSliderRow(
title: chargeVoltageTitle,
unit: "V",
@@ -957,7 +951,12 @@ struct BatteryEditorView: View {
saveTitle: alertSaveTitle
)
)
Text(chargeVoltageHelperText)
.font(.caption)
.foregroundStyle(.secondary)
}
VStack(alignment: .leading, spacing: 8) {
EditableSliderRow(
title: cutOffVoltageTitle,
unit: "V",
@@ -982,8 +981,17 @@ struct BatteryEditorView: View {
saveTitle: alertSaveTitle
)
)
Text(cutOffVoltageHelperText)
.font(.caption)
.foregroundStyle(.secondary)
}
VStack(alignment: .leading, spacing: 8) {
temperatureRangeRow
Text(temperatureRangeHelperText)
.font(.caption)
.foregroundStyle(.secondary)
}
}
.padding(.top, 6)
}

View File

@@ -1040,28 +1040,31 @@ struct CalculatorView: View {
.listRowSeparator(.hidden)
.listRowBackground(Color(.systemBackground))
}
VStack(alignment: .leading, spacing: 8) {
dutyCycleSlider
.listRowSeparator(.hidden)
.listRowBackground(Color(.systemBackground))
.opacity(advancedEnabled ? 1 : 0.35)
.allowsHitTesting(advancedEnabled)
Text(dutyCycleHelperText)
.font(.caption)
.foregroundStyle(.secondary)
.opacity(advancedEnabled ? 1 : 0.35)
}
VStack(alignment: .leading, spacing: 8) {
usageHoursSlider
.listRowSeparator(.hidden)
.listRowBackground(Color(.systemBackground))
.opacity(advancedEnabled ? 1 : 0.35)
.allowsHitTesting(advancedEnabled)
}
} footer: {
if isAdvancedExpanded {
VStack(alignment: .leading, spacing: 8) {
Text(dutyCycleHelperText)
Text(usageHoursHelperText)
}
.font(.caption)
.foregroundStyle(.secondary)
.opacity(advancedEnabled ? 1 : 0.35)
}
}
}
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets(top: 12, leading: 18, bottom: 12, trailing: 18))
.animation(.easeInOut(duration: 0.2), value: isAdvancedExpanded)