|
|
@@ -13,11 +13,17 @@ struct DesktopWidgetView: View {
|
|
|
var body: some View {
|
|
|
ZStack {
|
|
|
RoundedRectangle(cornerRadius: 22, style: .continuous)
|
|
|
- .fill(Color.white)
|
|
|
- .shadow(color: .black.opacity(0.12), radius: 10, x: 0, y: 7)
|
|
|
+ .fill(
|
|
|
+ LinearGradient(
|
|
|
+ colors: [Color(red: 0.18, green: 0.24, blue: 0.31), Color(red: 0.18, green: 0.47, blue: 0.46)],
|
|
|
+ startPoint: .topLeading,
|
|
|
+ endPoint: .bottomTrailing
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .shadow(color: .black.opacity(0.25), radius: 14, x: 0, y: 8)
|
|
|
.overlay(
|
|
|
RoundedRectangle(cornerRadius: 22, style: .continuous)
|
|
|
- .stroke(Color.black.opacity(0.10), lineWidth: 1)
|
|
|
+ .stroke(Color.white.opacity(0.12), lineWidth: 1)
|
|
|
)
|
|
|
|
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
|
@@ -49,7 +55,7 @@ struct DesktopWidgetView: View {
|
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
|
Text(app.name)
|
|
|
.font(.system(size: 16, weight: .bold))
|
|
|
- .foregroundStyle(.black.opacity(0.88))
|
|
|
+ .foregroundStyle(.white.opacity(0.92))
|
|
|
.lineLimit(1)
|
|
|
}
|
|
|
Spacer(minLength: 0)
|
|
|
@@ -70,7 +76,7 @@ struct DesktopWidgetView: View {
|
|
|
AppIconView(app: app, size: 44, showAppBackground: false, iconPaddingFactor: 0.05)
|
|
|
Text(title)
|
|
|
.font(.system(size: fontSize, weight: .bold))
|
|
|
- .foregroundStyle(.black.opacity(0.88))
|
|
|
+ .foregroundStyle(.white.opacity(0.92))
|
|
|
.lineLimit(1)
|
|
|
}
|
|
|
|
|
|
@@ -115,21 +121,21 @@ struct DesktopWidgetView: View {
|
|
|
HStack(spacing: 8) {
|
|
|
Image(systemName: action.systemImage)
|
|
|
.font(.system(size: 12, weight: .semibold))
|
|
|
- .foregroundStyle(.black.opacity(0.62))
|
|
|
+ .foregroundStyle(foregroundColor(for: action))
|
|
|
Text(action.title)
|
|
|
.font(.system(size: 12, weight: .bold))
|
|
|
- .foregroundStyle(.black.opacity(0.86))
|
|
|
+ .foregroundStyle(foregroundColor(for: action))
|
|
|
.lineLimit(1)
|
|
|
}
|
|
|
.padding(.horizontal, 12)
|
|
|
.padding(.vertical, 9)
|
|
|
.background(
|
|
|
RoundedRectangle(cornerRadius: 999, style: .continuous)
|
|
|
- .fill(Color.white)
|
|
|
+ .fill(backgroundColor(for: action))
|
|
|
)
|
|
|
.overlay(
|
|
|
RoundedRectangle(cornerRadius: 999, style: .continuous)
|
|
|
- .stroke(Color.black.opacity(0.12), lineWidth: 1)
|
|
|
+ .stroke(Color.white.opacity(isPrimary(action) ? 0.22 : 0.12), lineWidth: 1)
|
|
|
)
|
|
|
}
|
|
|
.buttonStyle(.plain)
|
|
|
@@ -142,10 +148,10 @@ struct DesktopWidgetView: View {
|
|
|
HStack(spacing: 10) {
|
|
|
Image(systemName: action.systemImage)
|
|
|
.font(.system(size: 12, weight: .semibold))
|
|
|
- .foregroundStyle(.black.opacity(0.62))
|
|
|
+ .foregroundStyle(foregroundColor(for: action))
|
|
|
Text(action.title)
|
|
|
.font(.system(size: 12, weight: .bold))
|
|
|
- .foregroundStyle(.black.opacity(0.86))
|
|
|
+ .foregroundStyle(foregroundColor(for: action))
|
|
|
.lineLimit(1)
|
|
|
Spacer(minLength: 0)
|
|
|
}
|
|
|
@@ -153,11 +159,11 @@ struct DesktopWidgetView: View {
|
|
|
.padding(.vertical, 10)
|
|
|
.background(
|
|
|
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
|
|
- .fill(Color.white)
|
|
|
+ .fill(backgroundColor(for: action))
|
|
|
)
|
|
|
.overlay(
|
|
|
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
|
|
- .stroke(Color.black.opacity(0.12), lineWidth: 1)
|
|
|
+ .stroke(Color.white.opacity(isPrimary(action) ? 0.22 : 0.12), lineWidth: 1)
|
|
|
)
|
|
|
}
|
|
|
.buttonStyle(.plain)
|
|
|
@@ -188,5 +194,17 @@ struct DesktopWidgetView: View {
|
|
|
}
|
|
|
return URL(string: actionPath, relativeTo: base)?.absoluteURL ?? base
|
|
|
}
|
|
|
+
|
|
|
+ private func isPrimary(_ action: WidgetAction) -> Bool {
|
|
|
+ actions.first?.id == action.id
|
|
|
+ }
|
|
|
+
|
|
|
+ private func backgroundColor(for action: WidgetAction) -> Color {
|
|
|
+ isPrimary(action) ? Color.white.opacity(0.38) : Color.black.opacity(0.66)
|
|
|
+ }
|
|
|
+
|
|
|
+ private func foregroundColor(for action: WidgetAction) -> Color {
|
|
|
+ isPrimary(action) ? Color.white.opacity(0.95) : Color.white.opacity(0.88)
|
|
|
+ }
|
|
|
}
|
|
|
|