feat: Styles views for macos

This commit is contained in:
2024-06-17 09:30:47 -04:00
parent 50e80d39eb
commit bd758fac90
7 changed files with 115 additions and 16 deletions

View File

@@ -133,18 +133,19 @@ public struct EquipmentSettingsFormView: View {
Form {
Section {
EquipmentTypePicker(selection: $store.equipmentType)
.dynamicBottomPadding()
.pickerStyle(.segmented)
EmptyView()
} header: {
Text("Equipment Type")
SectionHeaderLabel("Equipment Type")
}
.listRowBackground(Color.clear)
Section {
FanTypePicker(selection: $store.sharedSettings.fanType)
.dynamicBottomPadding()
.pickerStyle(.segmented)
} header: {
Text("Fan Type")
SectionHeaderLabel("Fan Type")
}
.listRowBackground(Color.clear)
@@ -175,11 +176,13 @@ public struct EquipmentSettingsFormView: View {
}
}
}
.dynamicBottomPadding()
// .applyPadding()
} header: {
if store.equipmentType == .airHandler {
EmptyView()
} else {
Text("Capacities")
SectionHeaderLabel("Capacities")
}
}
@@ -187,6 +190,7 @@ public struct EquipmentSettingsFormView: View {
Grid(alignment: .leading, horizontalSpacing: 40) {
ForEach(RatingsField.allCases, content: ratingsRow(for:))
}
.dynamicBottomPadding()
.labeledContentStyle(.gridRow)
} header: {
header("Rated Static Pressure", infoView: .ratedStaticPressures)
@@ -262,7 +266,7 @@ public struct EquipmentSettingsFormView: View {
label: @escaping () -> Label
) -> some View {
HStack {
label()
SectionHeaderLabel { label() }
Spacer()
InfoButton { send(.infoButtonTapped(infoView)) }
}
@@ -285,6 +289,17 @@ public struct EquipmentSettingsFormView: View {
}
}
fileprivate extension View {
@ViewBuilder
func applyPadding() -> some View {
#if os(macOS)
self.padding(.bottom, 20)
#else
self
#endif
}
}
fileprivate struct BudgetFlagViewStyle: FlaggedViewStyle {
func makeBody(configuration: Configuration) -> some View {