|
|
@@ -9,11 +9,11 @@ import SwiftUI
|
|
|
|
|
|
struct TaskView: View {
|
|
|
@Binding var task: Task
|
|
|
- @State private var showTags: Bool = false
|
|
|
+
|
|
|
@State private var hideTags: Bool = false
|
|
|
-
|
|
|
- @State private var showNotes: Bool = false
|
|
|
@State private var hideNotes: Bool = false
|
|
|
+
|
|
|
+ @FocusState private var isFocused: Bool
|
|
|
|
|
|
var body: some View {
|
|
|
VStack {
|
|
|
@@ -36,6 +36,7 @@ struct TaskView: View {
|
|
|
}
|
|
|
|
|
|
TextField("Task Name", text: $task.name)
|
|
|
+ .focused($isFocused)
|
|
|
Button() {
|
|
|
task.subtasks.append(SubTask(name: "Subtask"))
|
|
|
} label: {
|
|
|
@@ -44,21 +45,25 @@ struct TaskView: View {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if showTags || !(hideTags || task.tags.isEmpty) {
|
|
|
+ if isFocused || !(hideTags || task.tags.isEmpty) {
|
|
|
HStack {
|
|
|
TagBarView(tags: $task.tags)
|
|
|
.font(.footnote)
|
|
|
+ .focused($isFocused)
|
|
|
.padding(.leading, 30)
|
|
|
- ShowHideTapper(shown: $showTags, hideToggle: $hideTags)
|
|
|
+ VisibilityTapper(hideToggle: $hideTags)
|
|
|
+ .focused($isFocused)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if showNotes || !(hideNotes || task.notes.isEmpty) {
|
|
|
+ if isFocused || !(hideNotes || task.notes.isEmpty) {
|
|
|
HStack {
|
|
|
TextField("Notes", text: $task.notes)
|
|
|
.font(.footnote)
|
|
|
+ .focused($isFocused)
|
|
|
.padding(.leading, 30)
|
|
|
- ShowHideTapper(shown: $showNotes, hideToggle: $hideNotes)
|
|
|
+ VisibilityTapper(hideToggle: $hideNotes)
|
|
|
+ .focused($isFocused)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -70,9 +75,6 @@ struct TaskView: View {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }.onHover { yes in
|
|
|
- showTags = yes
|
|
|
- showNotes = yes
|
|
|
}
|
|
|
}
|
|
|
}
|