Add button command, fix list selection

This commit is contained in:
Christoph Hagen
2025-01-29 09:16:29 +01:00
parent eaad0a4bff
commit e291fbec52
11 changed files with 305 additions and 68 deletions

View File

@ -2,12 +2,20 @@ import SwiftUI
struct SettingsListView: View {
@Binding
var selectedSection: SettingsSection
@EnvironmentObject
private var selection: SelectedContent
var body: some View {
List(SettingsSection.allCases, selection: $selectedSection) { item in
Label(item.rawValue, systemSymbol: item.icon).tag(item)
List(SettingsSection.allCases) { section in
Label(section.rawValue, systemSymbol: section.icon)
.listRowBackground(RoundedRectangle(cornerRadius: 5)
.fill(selection.section == section ? Color.blue : Color.clear)
.padding(.horizontal, 10)
)
.contentShape(Rectangle())
.onTapGesture {
selection.section = section
}
}
}
}