|
|
@@ -308,28 +308,32 @@ private struct WidgetPreviewAddCard: View {
|
|
|
@State private var hovering = false
|
|
|
|
|
|
var body: some View {
|
|
|
- Button(action: onToggle) {
|
|
|
- WidgetPreviewCard(app: app, variant: variant)
|
|
|
- .contentShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
|
|
- .overlay(alignment: .topTrailing) {
|
|
|
- ZStack {
|
|
|
- Image(systemName: isAdded ? "minus" : "plus")
|
|
|
- .font(.system(size: 12, weight: .bold))
|
|
|
- .foregroundStyle(iconForegroundStyle)
|
|
|
- .frame(width: 26, height: 26)
|
|
|
- .background(
|
|
|
- Circle()
|
|
|
- .fill(iconBackgroundFill)
|
|
|
- )
|
|
|
- .shadow(color: .black.opacity(0.28), radius: 10, x: 0, y: 6)
|
|
|
- }
|
|
|
- .offset(x: 10, y: -10)
|
|
|
- .allowsHitTesting(false)
|
|
|
- .opacity(isAdded ? 1 : (hovering ? 1 : 0))
|
|
|
- .animation(.easeOut(duration: 0.12), value: hovering)
|
|
|
- }
|
|
|
+ ZStack(alignment: .topTrailing) {
|
|
|
+ Button(action: onToggle) {
|
|
|
+ WidgetPreviewCard(app: app, variant: variant)
|
|
|
+ .contentShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
|
|
+ }
|
|
|
+ .buttonStyle(.plain)
|
|
|
+
|
|
|
+ // Separate control so taps on the floating + work: the card is clip-shaped, so the
|
|
|
+ // offset circle was outside the label’s hit region when it was only an overlay.
|
|
|
+ Button(action: onToggle) {
|
|
|
+ Image(systemName: isAdded ? "minus" : "plus")
|
|
|
+ .font(.system(size: 12, weight: .bold))
|
|
|
+ .foregroundStyle(iconForegroundStyle)
|
|
|
+ .frame(width: 26, height: 26)
|
|
|
+ .background(
|
|
|
+ Circle()
|
|
|
+ .fill(iconBackgroundFill)
|
|
|
+ )
|
|
|
+ .shadow(color: .black.opacity(0.28), radius: 10, x: 0, y: 6)
|
|
|
+ .contentShape(Circle())
|
|
|
+ }
|
|
|
+ .buttonStyle(.plain)
|
|
|
+ .offset(x: 10, y: -10)
|
|
|
+ .opacity(isAdded ? 1 : (hovering ? 1 : 0))
|
|
|
+ .animation(.easeOut(duration: 0.12), value: hovering)
|
|
|
}
|
|
|
- .buttonStyle(.plain)
|
|
|
.onHover { hovering = $0 }
|
|
|
}
|
|
|
|