macOS widgets

This commit is contained in:
Hillel Coren 2023-06-22 17:02:33 +03:00
parent b343074e74
commit 50c58d4286
1 changed files with 32 additions and 21 deletions

View File

@ -115,7 +115,6 @@ struct Provider: IntentTimelineProvider {
formatter.numberStyle = .currency formatter.numberStyle = .currency
formatter.currencyCode = currency?.code ?? "USD" formatter.currencyCode = currency?.code ?? "USD"
let entry = SimpleEntry(date: Date(), let entry = SimpleEntry(date: Date(),
configuration: configuration, configuration: configuration,
widgetData: widgetData, widgetData: widgetData,
@ -199,21 +198,13 @@ struct DashboardWidgetEntryView : View {
var entry: Provider.Entry var entry: Provider.Entry
var body: some View { var body: some View {
/*
//Text(entry.widgetData?.tokens.keys.joined() ?? "BLANK")
//Text("TEST \(entry.configuration.field.rawValue)")
VStack {
//Text(entry.configuration.company?.identifier ?? "")
Text(entry.field)
Text("Value: \(entry.value)")
Text(entry.configuration.company?.displayString ?? "")
Text(entry.widgetData?.url ?? "")
}
*/
ZStack { ZStack {
Rectangle().fill(BackgroundStyle()) //Rectangle().fill(BackgroundStyle())
Rectangle().fill(Color.blue)
VStack(alignment: .leading) { VStack(alignment: .leading) {
HStack {
VStack {
Text(entry.field) Text(entry.field)
.font(.body) .font(.body)
.bold() .bold()
@ -223,7 +214,27 @@ struct DashboardWidgetEntryView : View {
.privacySensitive() .privacySensitive()
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
.minimumScaleFactor(0.8) .minimumScaleFactor(0.8)
.padding(.top, 8)
} }
.padding(.all)
}
.padding(.top, 8.0)
.background(ContainerRelativeShape().fill(Color(.white)))
Spacer()
Text(entry.configuration.company?.displayString ?? "")
.font(.body)
.bold()
.foregroundColor(Color.white)
Text("Date Range")
.font(.caption)
.foregroundColor(Color.white)
}
.padding(.all)
} }
} }
} }