Ingredients in ingredient lists can now be checked off.

This commit is contained in:
Vicnet
2023-10-10 14:10:40 +02:00
parent 9270c61df5
commit f2cad63bc0
2 changed files with 29 additions and 8 deletions

View File

@@ -149,17 +149,37 @@ struct RecipeIngredientSection: View {
Spacer()
}
ForEach(recipeDetail.recipeIngredient, id: \.self) { ingredient in
HStack(alignment: .top) {
Text("\u{2022}")
Text("\(ingredient)")
.multilineTextAlignment(.leading)
}
IngredientListItem(ingredient: ingredient)
.padding(4)
}
}.padding()
}
}
struct IngredientListItem: View {
@State var ingredient: String
@State var isSelected: Bool = false
var body: some View {
HStack(alignment: .top) {
if isSelected {
Image(systemName: "checkmark.circle")
} else {
//Text("\u{2022}")
Image(systemName: "circle")
}
Text("\(ingredient)")
.multilineTextAlignment(.leading)
.lineLimit(5)
}
.foregroundStyle(isSelected ? Color.secondary : Color.primary)
.onTapGesture {
isSelected.toggle()
}
.animation(.easeInOut, value: isSelected)
}
}
struct RecipeToolSection: View {
@State var recipeDetail: RecipeDetail
var body: some View {

View File

@@ -72,7 +72,8 @@ struct SettingsView: View {
} footer: {
Text("The selected cookbook will open on app launch by default.")
}
Section() {
Section {
Link("Visit the GitHub page", destination: URL(string: "https://github.com/VincentMeilinger/Nextcloud-Cookbook-iOS")!)
} header: {
Text("About")
@@ -80,7 +81,7 @@ struct SettingsView: View {
Text("If you are interested in contributing to this project or simply wish to review its source code, we encourage you to visit the GitHub repository for this application.")
}
Section() {
Section {
Link("Get support", destination: URL(string: "https://vincentmeilinger.github.io/Nextcloud-Cookbook-Client-Support/")!)
} header: {
Text("Support")
@@ -88,7 +89,7 @@ struct SettingsView: View {
Text("If you have any inquiries, feedback, or require assistance, please refer to the support page for contact information.")
}
Section() {
Section {
Button("Log out") {
print("Log out.")
alertType = .LOG_OUT