1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30: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,6 +7,10 @@ struct ControlBackgroundModifier: ViewModifier {
func body(content: Content) -> some View { func body(content: Content) -> some View {
if enabled { if enabled {
if #available(iOS 15, macOS 12, *) {
content
.background(.thinMaterial)
} else {
content content
#if os(macOS) #if os(macOS)
.background(VisualEffectBlur(material: .hudWindow)) .background(VisualEffectBlur(material: .hudWindow))
@ -15,6 +19,7 @@ struct ControlBackgroundModifier: ViewModifier {
#else #else
.background(.thinMaterial) .background(.thinMaterial)
#endif #endif
}
} else { } else {
content content
} }

View File

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

View File

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