fix: Add button moved to sticky bottom bar — always tappable on first tap
- Button outside ScrollView using safeAreaInset(edge: .bottom) - No more scroll gesture eating the first tap - scrollDismissesKeyboard(.immediately) for keyboard handling - Swipe to delete on meal entries Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -165,29 +165,33 @@ struct AddFoodSheet: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.red)
|
.foregroundStyle(.red)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add button
|
|
||||||
Button {
|
|
||||||
addEntry()
|
|
||||||
} label: {
|
|
||||||
if isAdding {
|
|
||||||
ProgressView()
|
|
||||||
.tint(.white)
|
|
||||||
} else {
|
|
||||||
Text("Add to \(selectedMeal.displayName)")
|
|
||||||
.font(.headline)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
.frame(height: 50)
|
|
||||||
.background(Color.accentWarm)
|
|
||||||
.foregroundStyle(.white)
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
||||||
.disabled(isAdding)
|
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
.scrollDismissesKeyboard(.immediately)
|
||||||
.background(Color.canvas)
|
.background(Color.canvas)
|
||||||
|
.safeAreaInset(edge: .bottom) {
|
||||||
|
Button {
|
||||||
|
addEntry()
|
||||||
|
} label: {
|
||||||
|
if isAdding {
|
||||||
|
ProgressView()
|
||||||
|
.tint(.white)
|
||||||
|
} else {
|
||||||
|
Text("Add to \(selectedMeal.displayName)")
|
||||||
|
.font(.headline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.frame(height: 50)
|
||||||
|
.background(Color.accentWarm)
|
||||||
|
.foregroundStyle(.white)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||||
|
.disabled(isAdding)
|
||||||
|
.padding(.horizontal)
|
||||||
|
.padding(.bottom, 8)
|
||||||
|
.background(Color.canvas)
|
||||||
|
}
|
||||||
.navigationTitle("Add Food")
|
.navigationTitle("Add Food")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
|||||||
Reference in New Issue
Block a user