PWD-1: display text after updating list

This commit is contained in:
Markus Thielker 2025-01-23 17:30:49 +01:00
parent bb4cb2a0d3
commit 6b1be3378a
No known key found for this signature in database

View file

@ -15,8 +15,9 @@ struct ListView: View {
@ObservedObject var viewModel: ListViewModel
@State var isAddingPassword: Bool = false
@State var selectedItem: UUID?
@State private var isAddingPassword: Bool = false
@State private var isUpdateTextVisible: Bool = false
@State private var selectedItem: UUID?
var body: some View {
NavigationStack {
@ -41,6 +42,10 @@ struct ListView: View {
size: .icon,
action: {
viewModel.passwords = viewModel.getAllPasswords()
isUpdateTextVisible = true
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
isUpdateTextVisible = false
}
}
)
}
@ -58,6 +63,11 @@ struct ListView: View {
.foregroundColor(selectedItem == password.id ? .white : (colorScheme == .dark ? .white : .black))
.cornerRadius(8)
}
if isUpdateTextVisible {
Text("List updated")
.animation(.easeInOut(duration: 1), value: isUpdateTextVisible)
}
}
.frame(width: 250)
.listStyle(SidebarListStyle())