Add button command, fix list selection
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user