Toast: Use a background blur instead of a shadow

Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
kingbri 2022-08-26 00:33:15 -04:00 committed by kingbri
parent 62f1717c83
commit 49010a270e
2 changed files with 13 additions and 9 deletions

View file

@ -25,7 +25,7 @@ class ToastViewModel: ObservableObject {
try? await Task.sleep(seconds: 0.1)
showToast = true
try await Task.sleep(seconds: 5)
try? await Task.sleep(seconds: 5)
showToast = false
toastType = .error

View file

@ -6,6 +6,7 @@
//
import SwiftUI
import SwiftUIX
struct MainView: View {
@EnvironmentObject var navModel: NavigationViewModel
@ -35,7 +36,7 @@ struct MainView: View {
VStack {
Spacer()
if toastModel.showToast {
GroupBox {
Group {
switch toastModel.toastType {
case .info:
Text(toastModel.toastDescription ?? "This shouldn't be showing up... Contact the dev!")
@ -43,15 +44,18 @@ struct MainView: View {
Text("Error: \(toastModel.toastDescription ?? "This shouldn't be showing up... Contact the dev!")")
}
}
.groupBoxStyle(ErrorGroupBoxStyle())
Rectangle()
.foregroundColor(.clear)
.frame(height: 60)
.padding(12)
.font(.caption)
.background {
VisualEffectBlurView(blurStyle: .systemThinMaterial)
}
.cornerRadius(10)
}
Rectangle()
.foregroundColor(.clear)
.frame(height: 60)
}
.font(.caption)
.shadow(radius: 10)
.animation(.easeInOut(duration: 0.3), value: toastModel.showToast)
}
}