mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update Liquid Glass for Lock Screen Widgets
This commit is contained in:
parent
8720de3cf7
commit
2d86127175
5 changed files with 31 additions and 162 deletions
|
|
@ -83,7 +83,9 @@ struct ExtensionLockScreenWidgetView: View {
|
|||
|
||||
@ViewBuilder
|
||||
private func backgroundLayer(shape: RoundedRectangle) -> some View {
|
||||
if shouldUseGlassBackdrop {
|
||||
if descriptor.material == .liquid {
|
||||
liquidGlassBackground(shape: shape)
|
||||
} else if shouldUseGlassHighlight {
|
||||
if #available(macOS 26.0, *) {
|
||||
ZStack {
|
||||
shape
|
||||
|
|
@ -110,6 +112,18 @@ struct ExtensionLockScreenWidgetView: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func liquidGlassBackground(shape: RoundedRectangle) -> some View {
|
||||
LiquidGlassBackground(variant: requestedLiquidGlassVariant, cornerRadius: descriptor.cornerRadius) {
|
||||
Color.black.opacity(0.08)
|
||||
}
|
||||
.overlay {
|
||||
tintOverlay(shape: shape)
|
||||
}
|
||||
.allowsHitTesting(false)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
|
||||
private var baseMaterialStyle: AnyShapeStyle {
|
||||
switch descriptor.material {
|
||||
case .frosted:
|
||||
|
|
@ -160,8 +174,15 @@ struct ExtensionLockScreenWidgetView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private var shouldUseGlassBackdrop: Bool {
|
||||
descriptor.material == .liquid || (appearance?.enableGlassHighlight ?? false)
|
||||
private var shouldUseGlassHighlight: Bool {
|
||||
(appearance?.enableGlassHighlight ?? false) && descriptor.material != .liquid
|
||||
}
|
||||
|
||||
private var requestedLiquidGlassVariant: LiquidGlassVariant {
|
||||
guard let requested = appearance?.liquidGlassVariant?.rawValue else {
|
||||
return LiquidGlassVariant.defaultVariant
|
||||
}
|
||||
return LiquidGlassVariant.clamped(requested)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue