fix: Add button moved to sticky bottom bar — always tappable on first tap
All checks were successful
Security Checks / dependency-audit (push) Successful in 13s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 3s

- 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:
Yusuf Suleman
2026-04-03 11:15:53 -05:00
parent d95c629845
commit b78e230eda

View File

@@ -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 {