Add add button to list view for decks and edit to toolbar

This commit is contained in:
2024-05-03 22:09:37 +02:00
parent 880315ee53
commit ecdea1de2f

View File

@@ -15,6 +15,14 @@ struct DeckListView: View {
var body: some View { var body: some View {
NavigationStack { NavigationStack {
List { List {
Button(action: {
self.addDeck = true
}) {
HStack {
Image(systemName: "plus.circle.fill")
Text("Add new deck")
}
}
ForEach(decks) { deck in ForEach(decks) { deck in
NavigationLink { NavigationLink {
FlashCardListView(deck: deck) FlashCardListView(deck: deck)
@@ -37,11 +45,7 @@ struct DeckListView: View {
} }
.toolbar { .toolbar {
ToolbarItemGroup(placement: .topBarTrailing) { ToolbarItemGroup(placement: .topBarTrailing) {
Button(action: { EditButton()
self.addDeck = true
}) {
Image(systemName: "plus")
}
} }
} }
.navigationTitle("All decks") .navigationTitle("All decks")