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 {
if enabled {
if #available(iOS 15, macOS 12, *) {
content
.background(.thinMaterial)
} else {
content
#if os(macOS)
.background(VisualEffectBlur(material: .hudWindow))
@ -15,6 +19,7 @@ struct ControlBackgroundModifier: ViewModifier {
#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,11 +127,7 @@ 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
.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
}
.modifier(ControlBackgroundModifier())
}
}