From 310dcd918baeb20081d1c24de16848e838b5f96f Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 19 Oct 2023 11:47:10 -0600 Subject: [PATCH] Add top-right icon image, adjust colors of text and progress gauge --- .../WonderWidgetViewComponents.swift | 8 ++++---- ios/Wonderous Widget/WonderousWidgetView.swift | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ios/Wonderous Widget/WonderWidgetViewComponents.swift b/ios/Wonderous Widget/WonderWidgetViewComponents.swift index 6b71368d..42e09237 100644 --- a/ios/Wonderous Widget/WonderWidgetViewComponents.swift +++ b/ios/Wonderous Widget/WonderWidgetViewComponents.swift @@ -15,12 +15,12 @@ struct BgImage : View { var entry: WonderousEntry var body: some View { let image = bundle.appending(path: "/assets/images/widget/background-empty.jpg").path(); - print(image) + //print(image) if let uiImage = UIImage(contentsOfFile: image) { let image = Image(uiImage: uiImage) .resizable() .aspectRatio(contentMode: .fill) // Fill the entire view - // .edgesIgnoringSafeArea(.all) // Ignore the safe area + .edgesIgnoringSafeArea(.all) // Ignore the safe area return AnyView(image) } print("The image file could not be loaded") @@ -48,7 +48,7 @@ struct NetImage : View { } struct GaugeProgressStyle: ProgressViewStyle { - + let color:Color func makeBody(configuration: Configuration) -> some View { let fractionCompleted = configuration.fractionCompleted ?? 0 @@ -57,7 +57,7 @@ struct GaugeProgressStyle: ProgressViewStyle { .stroke(.gray, style: StrokeStyle(lineWidth: 2)) Circle() .trim(from: 0, to: fractionCompleted) - .stroke(.red, style: StrokeStyle(lineWidth: 4, lineCap: .round)) + .stroke(color, style: StrokeStyle(lineWidth: 4, lineCap: .round)) .rotationEffect(.degrees(90)) } } diff --git a/ios/Wonderous Widget/WonderousWidgetView.swift b/ios/Wonderous Widget/WonderousWidgetView.swift index 1413320d..8f90e15e 100644 --- a/ios/Wonderous Widget/WonderousWidgetView.swift +++ b/ios/Wonderous Widget/WonderousWidgetView.swift @@ -10,16 +10,18 @@ struct WonderousWidgetView : View { let showTitle = family == .systemLarge let showIcon = family != .systemSmall let showTitleAndDesc = family != .systemSmall - let textColor:Color = .pink + let accentColor:Color = Color("AccentColor") let progress = 7.0 / 32.0; + let image = bundle.appending(path: "/assets/images/widget/wonderous-icon.png").path(); let content = VStack{ HStack { if(showTitle) { - Text("Collection").foregroundColor(textColor) + Text("Collection").foregroundColor(accentColor) } Spacer(); - if(showIcon) { - Text("1").foregroundColor(textColor) + if(showIcon || true) { + Image(uiImage: UIImage(contentsOfFile: image)!) + .resizable().scaledToFit().frame(height: 24) } } Spacer(); @@ -28,7 +30,7 @@ struct WonderousWidgetView : View { VStack(alignment: .leading){ Text("Wonderous") .font(.system(size: 22)) - .foregroundColor(textColor); + .foregroundColor(accentColor); Text("Search for hidden artifacts") .font(.system(size: 15)) .foregroundColor(Color("GreyMediumColor")); @@ -38,10 +40,10 @@ struct WonderousWidgetView : View { ZStack{ ProgressView(value: progress) .progressViewStyle( - GaugeProgressStyle() + GaugeProgressStyle(color: accentColor) ) .frame(width: 48, height: 48) - Text("\(Int(progress * 100))%").font(.system(size: 12)).foregroundColor(textColor) + Text("\(Int(progress * 100))%").font(.system(size: 12)).foregroundColor(accentColor) } } //NetImage(imageData: netImgData)