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

@ -51,8 +51,19 @@ struct FileListView: View {
TextField("", text: $searchString, prompt: Text("Search"))
.textFieldStyle(.roundedBorder)
.padding(.horizontal, 8)
List(filteredFiles, selection: $selectedFile) { file in
Text(file.id).tag(file)
List(filteredFiles) { file in
HStack {
Text(file.id)
Spacer()
}
.listRowBackground(RoundedRectangle(cornerRadius: 5)
.fill(selectedFile == file ? Color.blue : Color.clear)
.padding(.horizontal, 10)
)
.contentShape(Rectangle())
.onTapGesture {
selectedFile = file
}
}
.onChange(of: selectedFileType) { oldValue, newValue in
guard oldValue != newValue else {