Просмотр исходного кода

change background color of side menu to match home root view background color

polscm32 2 лет назад
Родитель
Сommit
1e5f5b26ba
1 измененных файлов с 63 добавлено и 59 удалено
  1. 63 59
      FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

+ 63 - 59
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -780,78 +780,82 @@ extension Home {
         }
 
         @ViewBuilder func sideMenuView() -> some View {
-            VStack(alignment: .leading) {
-                Button {
-                    isMenuPresented.toggle()
-                } label: {
-                    HStack {
-                        Image(systemName: "arrow.left")
-                            .font(.system(size: 30))
-                            .foregroundStyle(colorScheme == .dark ? .white : .black)
-                        Text("Menu")
-                            .font(.system(size: 30)).fontWeight(.bold)
-                            .foregroundStyle(colorScheme == .dark ? .white : .black)
+            ZStack {
+                RoundedRectangle(cornerRadius: 8)
+                    .fill(color)
+                    .shadow(
+                        color: Color.black.opacity(0.33),
+                        radius: 3)
+                    .ignoresSafeArea(edges: .all)
+
+                VStack(alignment: .leading) {
+                    Button {
+                        isMenuPresented.toggle()
+                    } label: {
+                        HStack {
+                            Image(systemName: "arrow.left")
+                                .font(.system(size: 30))
+                                .foregroundStyle(colorScheme == .dark ? .white : .black)
+                            Text("Menu")
+                                .font(.system(size: 30)).fontWeight(.bold)
+                                .foregroundStyle(colorScheme == .dark ? .white : .black)
+                        }
                     }
-                }
-                .padding(.top, 60)
+                    .padding(.top, 60)
 
-                HStack(spacing: 15) {
-                    VStack(alignment: .leading, spacing: 25, content: {
-                        menuSymbols(action: { state.showModal(for: .statistics) }, systemName: "chart.bar.xaxis")
-                            .padding(.top, 20)
+                    HStack(spacing: 15) {
+                        VStack(alignment: .leading, spacing: 25, content: {
+                            menuSymbols(action: { state.showModal(for: .statistics) }, systemName: "chart.bar.xaxis")
+                                .padding(.top, 20)
 
-                        menuSymbols(action: {
-                            if state.pumpDisplayState != nil {
-                                state.setupPump = true
-                            }
-                        }, systemName: "cross.vial.fill")
+                            menuSymbols(action: {
+                                if state.pumpDisplayState != nil {
+                                    state.setupPump = true
+                                }
+                            }, systemName: "cross.vial.fill")
 
-                        menuSymbols(action: {
-                            if state.alarm == nil {
-                                state.openCGM()
-                            } else {
-                                state.showModal(for: .snooze)
-                            }
-                        }, systemName: "sensor.tag.radiowaves.forward.fill")
+                            menuSymbols(action: {
+                                if state.alarm == nil {
+                                    state.openCGM()
+                                } else {
+                                    state.showModal(for: .snooze)
+                                }
+                            }, systemName: "sensor.tag.radiowaves.forward.fill")
 
-                        menuSymbols(action: { state.showModal(for: .addTempTarget) }, systemName: "target")
+                            menuSymbols(action: { state.showModal(for: .addTempTarget) }, systemName: "target")
 
-                        menuSymbols(action: { state.showModal(for: .settings) }, systemName: "gear")
+                            menuSymbols(action: { state.showModal(for: .settings) }, systemName: "gear")
 
-                        Spacer()
-                    })
-                    VStack(alignment: .leading, spacing: 25, content: {
-                        menuElements(action: { state.showModal(for: .statistics) }, title: "Statistics")
-                            .padding(.top, 20)
-
-                        menuElements(action: {
-                            if state.pumpDisplayState != nil {
-                                state.setupPump = true
-                            }
-                        }, title: "Pump Settings")
+                            Spacer()
+                        })
+                        VStack(alignment: .leading, spacing: 25, content: {
+                            menuElements(action: { state.showModal(for: .statistics) }, title: "Statistics")
+                                .padding(.top, 20)
+
+                            menuElements(action: {
+                                if state.pumpDisplayState != nil {
+                                    state.setupPump = true
+                                }
+                            }, title: "Pump Settings")
 
-                        menuElements(action: {
-                            if state.alarm == nil {
-                                state.openCGM()
-                            } else {
-                                state.showModal(for: .snooze)
-                            }
-                        }, title: "CGM")
+                            menuElements(action: {
+                                if state.alarm == nil {
+                                    state.openCGM()
+                                } else {
+                                    state.showModal(for: .snooze)
+                                }
+                            }, title: "CGM")
 
-                        menuElements(action: { state.showModal(for: .addTempTarget) }, title: "Temp targets")
+                            menuElements(action: { state.showModal(for: .addTempTarget) }, title: "Temp targets")
 
-                        menuElements(action: { state.showModal(for: .settings) }, title: "Settings")
+                            menuElements(action: { state.showModal(for: .settings) }, title: "Settings")
 
-                        Spacer()
-                    })
-                }
+                            Spacer()
+                        })
+                    }
+                }.padding(.horizontal, 25)
             }
-            .padding(.horizontal, 25)
             .frame(width: UIScreen.main.bounds.width / 1.2, height: UIScreen.main.bounds.height - 20)
-            .overlay {
-                RoundedRectangle(cornerRadius: 8).stroke(Color.primary.opacity(0.2), lineWidth: 2).shadow(radius: 3)
-                    .ignoresSafeArea(edges: .all)
-            }
         }
 
         @ViewBuilder func mainView() -> some View {