mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-22 06:15:59 +00:00
Add liquid glass for toast view
This commit is contained in:
1 parent
e1924e1919
commit
3ed93e6079
1 file changed
+17
-1
@@ -218,7 +218,7 @@ struct QuickDropToastView: View {
|
|||||||
startAutoHideIfPossible()
|
startAutoHideIfPossible()
|
||||||
}
|
}
|
||||||
.background(
|
.background(
|
||||||
VisualEffectView(material: .hudWindow, cornerRadius: toastCornerRadius)
|
AdaptiveToastBackgroundLayer(cornerRadius: toastCornerRadius)
|
||||||
)
|
)
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: toastCornerRadius, style: .continuous)
|
RoundedRectangle(cornerRadius: toastCornerRadius, style: .continuous)
|
||||||
@@ -387,6 +387,22 @@ fileprivate struct ActionDividerLine: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct AdaptiveToastBackgroundLayer: View {
|
||||||
|
let cornerRadius: CGFloat
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Group {
|
||||||
|
if #available(macOS 26.0, *) {
|
||||||
|
Color.clear
|
||||||
|
.glassEffect(.regular, in: .rect(cornerRadius: cornerRadius, style: .continuous))
|
||||||
|
} else {
|
||||||
|
VisualEffectView(material: .hudWindow, cornerRadius: cornerRadius)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy
|
// NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy
|
||||||
struct VisualEffectView: NSViewRepresentable {
|
struct VisualEffectView: NSViewRepresentable {
|
||||||
var material: NSVisualEffectView.Material = .hudWindow
|
var material: NSVisualEffectView.Material = .hudWindow
|
||||||
|
|||||||
Reference in new issue
Block a user