Add top-right icon image, adjust colors of text and progress gauge

This commit is contained in:
Shawn 2023-10-19 11:47:10 -06:00
parent 0cff2e5ecc
commit 310dcd918b
2 changed files with 13 additions and 11 deletions

View File

@ -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))
}
}

View File

@ -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)