1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30

Improve translucency effect

This commit is contained in:
Arkadiusz Fal 2022-08-06 15:26:59 +02:00
parent f359b75d63
commit 5e1cb5a2fe
3 changed files with 18 additions and 26 deletions

View File

@ -7,14 +7,19 @@ struct ControlBackgroundModifier: ViewModifier {
func body(content: Content) -> some View {
if enabled {
content
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
#elseif os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial).edgesIgnoringSafeArea(edgesIgnoringSafeArea))
#else
.background(.thinMaterial)
#endif
if #available(iOS 15, macOS 12, *) {
content
.background(.thinMaterial)
} else {
content
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
#elseif os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial).edgesIgnoringSafeArea(edgesIgnoringSafeArea))
#else
.background(.thinMaterial)
#endif
}
} else {
content
}

View File

@ -114,7 +114,7 @@ struct ControlsOverlay: View {
StreamControl()
.frame(width: 45, height: 30)
#if os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial))
.modifier(ControlBackgroundModifier())
#endif
.mask(RoundedRectangle(cornerRadius: 3))
} label: {
@ -127,12 +127,8 @@ struct ControlsOverlay: View {
.buttonStyle(.plain)
.foregroundColor(.primary)
.frame(width: 140, height: 30)
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
#elseif os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial))
#endif
.mask(RoundedRectangle(cornerRadius: 3))
.modifier(ControlBackgroundModifier())
.mask(RoundedRectangle(cornerRadius: 3))
#endif
}

View File

@ -29,17 +29,8 @@ struct DetailBadge: View {
@Environment(\.colorScheme) private var colorScheme
func body(content: Content) -> some View {
if #available(iOS 15.0, macOS 12.0, tvOS 15.0, *) {
content
.background(.thinMaterial)
} else {
content
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
#elseif os(iOS)
.background(VisualEffectBlur(blurStyle: .systemThinMaterial))
#endif
}
content
.modifier(ControlBackgroundModifier())
}
}