2023-10-19 11:29:48 -06:00
|
|
|
import WidgetKit
|
|
|
|
import SwiftUI
|
|
|
|
import Intents
|
|
|
|
|
|
|
|
// Defines the view / layout of the widget
|
|
|
|
struct WonderousWidgetView : View {
|
|
|
|
@Environment(\.widgetFamily) var family: WidgetFamily
|
|
|
|
var entry: Provider.Entry
|
|
|
|
var body: some View {
|
|
|
|
let showTitle = family == .systemLarge
|
|
|
|
let showIcon = family != .systemSmall
|
|
|
|
let showTitleAndDesc = family != .systemSmall
|
2023-10-19 11:47:10 -06:00
|
|
|
let accentColor:Color = Color("AccentColor")
|
2023-10-19 11:29:48 -06:00
|
|
|
let progress = 7.0 / 32.0;
|
2023-10-19 11:47:10 -06:00
|
|
|
let image = bundle.appending(path: "/assets/images/widget/wonderous-icon.png").path();
|
2023-10-19 11:29:48 -06:00
|
|
|
let content = VStack{
|
|
|
|
HStack {
|
|
|
|
if(showTitle) {
|
2023-10-19 11:47:10 -06:00
|
|
|
Text("Collection").foregroundColor(accentColor)
|
2023-10-19 11:29:48 -06:00
|
|
|
}
|
|
|
|
Spacer();
|
2023-10-19 11:47:10 -06:00
|
|
|
if(showIcon || true) {
|
|
|
|
Image(uiImage: UIImage(contentsOfFile: image)!)
|
|
|
|
.resizable().scaledToFit().frame(height: 24)
|
2023-10-19 11:29:48 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Spacer();
|
|
|
|
HStack {
|
|
|
|
if(showTitleAndDesc) {
|
|
|
|
VStack(alignment: .leading){
|
|
|
|
Text("Wonderous")
|
|
|
|
.font(.system(size: 22))
|
2023-10-19 11:47:10 -06:00
|
|
|
.foregroundColor(accentColor);
|
2023-10-19 11:29:48 -06:00
|
|
|
Text("Search for hidden artifacts")
|
|
|
|
.font(.system(size: 15))
|
|
|
|
.foregroundColor(Color("GreyMediumColor"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Spacer();
|
|
|
|
ZStack{
|
|
|
|
ProgressView(value: progress)
|
|
|
|
.progressViewStyle(
|
2023-10-19 11:47:10 -06:00
|
|
|
GaugeProgressStyle(color: accentColor)
|
2023-10-19 11:29:48 -06:00
|
|
|
)
|
|
|
|
.frame(width: 48, height: 48)
|
2023-10-19 11:47:10 -06:00
|
|
|
Text("\(Int(progress * 100))%").font(.system(size: 12)).foregroundColor(accentColor)
|
2023-10-19 11:29:48 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//NetImage(imageData: netImgData)
|
|
|
|
}.widgetURL(URL(string: "wonderous://collections"))
|
|
|
|
|
|
|
|
ZStack{
|
|
|
|
BgImage(entry: entry)
|
|
|
|
LinearGradient(
|
|
|
|
gradient: Gradient(colors: [.black.opacity(0), .black]),
|
|
|
|
startPoint: .center,
|
|
|
|
endPoint: .bottom)
|
|
|
|
switch(family) {
|
|
|
|
case .systemSmall:
|
|
|
|
content.padding(16)
|
|
|
|
default:
|
|
|
|
content.padding(32)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|