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

fix treatment button and scrolling behavior

polscm32 1 год назад
Родитель
Сommit
3fc864f43b
1 измененных файлов с 15 добавлено и 30 удалено
  1. 15 30
      FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

+ 15 - 30
FreeAPS/Sources/Modules/Bolus/View/BolusRootView.swift

@@ -301,12 +301,10 @@ extension Bolus {
                                 Toggle("", isOn: $state.externalInsulin).toggleStyle(Checkbox())
                             }
                         }.listRowBackground(Color.chart)
+
+                        treatmentButton
                     }
                 }
-                .safeAreaInset(edge: .bottom, content: {
-                    stickyButton
-                })
-                .ignoresSafeArea(.keyboard, edges: .bottom)
                 .blur(radius: state.waitForSuggestion ? 5 : 0)
 
                 if state.waitForSuggestion {
@@ -371,33 +369,20 @@ extension Bolus {
             }
         }
 
-        var stickyButton: some View {
-            ZStack {
-                Rectangle()
-                    .frame(width: UIScreen.main.bounds.width, height: 120).offset(y: 40)
-                    .shadow(
-                        color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
-                            Color.black.opacity(0.33),
-                        radius: 3
-                    )
-                    .foregroundStyle(Color.chart)
-
-                Button {
-                    state.invokeTreatmentsTask()
-                } label: {
-                    taskButtonLabel
-                        .font(.headline)
-                        .foregroundStyle(Color.white)
-                        .frame(maxWidth: .infinity, alignment: .center)
-                        .frame(minHeight: 50)
-                }
-                .disabled(disableTaskButton)
-                .background(limitExceeded ? Color(.systemRed) : Color(.systemBlue))
-                .shadow(radius: 3)
-                .clipShape(RoundedRectangle(cornerRadius: 8))
-                .padding()
-                .offset(y: 20)
+        var treatmentButton: some View {
+            Button {
+                state.invokeTreatmentsTask()
+            } label: {
+                taskButtonLabel
+                    .font(.headline)
+                    .foregroundStyle(Color.white)
+                    .frame(maxWidth: .infinity, alignment: .center)
+                    .frame(height: 35)
             }
+            .disabled(disableTaskButton)
+            .listRowBackground(limitExceeded ? Color(.systemRed) : Color(.systemBlue))
+            .shadow(radius: 3)
+            .clipShape(RoundedRectangle(cornerRadius: 8))
         }
 
         private var taskButtonLabel: some View {