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

change appearance of progress view, blur background when progress view is toggled

polscm32 2 лет назад
Родитель
Сommit
3b75976435

+ 25 - 14
FreeAPS/Sources/Helpers/CustomProgressView.swift

@@ -1,26 +1,37 @@
 import SwiftUI
 
 struct CustomProgressView: View {
+    @State var animate = false
+
     let text: String
 
     @Environment(\.colorScheme) var colorScheme
 
     var body: some View {
-        ZStack(alignment: .center) {
-            RoundedRectangle(cornerRadius: 15)
-                .fill(Color(.systemGray4))
-                .clipShape(RoundedRectangle(cornerRadius: 15))
-                .shadow(
-                    color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
-                        Color.black.opacity(0.33),
-                    radius: 3
-                )
-                .padding(.horizontal, 10)
-                .frame(maxHeight: UIScreen.main.bounds.height / 11)
+        ZStack {
+            Text(text)
+                .font(.system(.body, design: .rounded))
+                .bold()
+                .offset(x: 0, y: -25)
+
+            RoundedRectangle(cornerRadius: 3)
+                .stroke(Color(.systemGray5), lineWidth: 3)
+                .frame(width: 250, height: 3)
 
-            ProgressView {
-                Text(text)
-            }
+            RoundedRectangle(cornerRadius: 3)
+                .stroke(LinearGradient(colors: [
+                    Color(red: 0.7215686275, green: 0.3411764706, blue: 1),
+                    Color(red: 0.6235294118, green: 0.4235294118, blue: 0.9803921569),
+                    Color(red: 0.4862745098, green: 0.5450980392, blue: 0.9529411765),
+                    Color(red: 0.3411764706, green: 0.6666666667, blue: 0.9254901961),
+                    Color(red: 0.262745098, green: 0.7333333333, blue: 0.9137254902)
+                ], startPoint: .leading, endPoint: .trailing), lineWidth: 3)
+                .frame(width: 30, height: 3)
+                .offset(x: self.animate ? 110 : -110, y: 0)
+                .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false), value: UUID())
+        }
+        .onAppear {
+            self.animate.toggle()
         }
     }
 }

+ 2 - 2
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -467,10 +467,10 @@ extension DataTable {
                             }
                             .listRowBackground(listBackgroundColor).tint(.white)
                         }.scrollContentBackground(.hidden).background(color)
-                    }
+                    }.blur(radius: state.waitForSuggestion ? 5 : 0)
 
                     if state.waitForSuggestion {
-                        CustomProgressView(text: "Adding Insulin...")
+                        CustomProgressView(text: "Updating IOB")
                     }
                 }
                 .onAppear(perform: configureView)