Fixed animation. Made menu a touch smaller.

This commit is contained in:
Ben Weeks
2023-01-07 23:59:35 +00:00
parent 392281ca40
commit 4378397c4c

View File

@@ -16,7 +16,7 @@ struct SideMenuView: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
var sideBarWidth = UIScreen.main.bounds.size.width * 0.7 var sideBarWidth = UIScreen.main.bounds.size.width * 0.65
func fillColor() -> Color { func fillColor() -> Color {
colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack") colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
@@ -27,21 +27,20 @@ struct SideMenuView: View {
} }
var body: some View { var body: some View {
if isSidebarVisible { ZStack {
ZStack { GeometryReader { _ in
GeometryReader { _ in EmptyView()
EmptyView()
}
.background(.gray.opacity(0.6))
.opacity(isSidebarVisible ? 1 : 0)
.animation(.easeInOut.delay(0.2), value: isSidebarVisible)
.onTapGesture {
isSidebarVisible.toggle()
}
content
} }
.edgesIgnoringSafeArea(.all) .background(.gray.opacity(0.6))
.opacity(isSidebarVisible ? 1 : 0)
.animation(.easeInOut.delay(0.2), value: isSidebarVisible)
.onTapGesture {
isSidebarVisible.toggle()
}
content
} }
.edgesIgnoringSafeArea(.all)
} }
var content: some View { var content: some View {
@@ -109,8 +108,8 @@ struct SideMenuView: View {
.foregroundColor(textColor()) .foregroundColor(textColor())
}) })
} }
.padding(.top, 50) .padding(.top, 60)
.padding(.bottom, 50) .padding(.bottom, 40)
.padding(.leading, 40) .padding(.leading, 40)
} }
.frame(width: sideBarWidth) .frame(width: sideBarWidth)