The code that has the issue is this
ZStack {
Image(systemName: icon.isEmpty ? "book.pages.fill" : icon)
.resizable()
.scaledToFit()
.scaleEffect(2.5)
.foregroundStyle(.ultraThickMaterial)
}
the book.pages.fill
is completely blurry and the lung
is partly blurred.
If I remove the .forgroundStyle(.ultraThickMaterial)
is is completely blurred.
Some icons, tho, are sharp no matter the forgroundStyle is omitted or not.
COULD NOT UPLOUD IMAGE
Here is the complete code
import SwiftUI
struct FolderOverviewItemView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(\.verticalSizeClass) private var verticalSizeClass
var title: String
var description: String
var icon: String
var image: Image? = Image("dummy")
var color: Color
var body: some View {
Grid {
GridRow() {
Color.clear
Color.clear
Color.clear
Color.clear
}
GridRow() {
Color.clear
ZStack {
Image(systemName: icon.isEmpty ? "book.pages.fill" : icon)
.resizable()
.scaledToFit()
.scaleEffect(2.5)
.foregroundStyle(.ultraThickMaterial)
}
.gridCellColumns(2)
Color.clear
}
GridRow() {
Color.clear
Color.clear
Color.clear
Color.clear
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
GridRow() {
HStack(alignment: .top) {
VStack(alignment: .leading) {
Text(title)
.font(.headline)
.lineLimit(1, reservesSpace: true)
if horizontalSizeClass == .regular {
Text(description.isEmpty ? " " : description)
.font(.caption)
.lineLimit(2, reservesSpace: true)
.truncationMode(.tail)
} else {
Text(description.isEmpty ? " " : description)
.font(.caption)
.lineLimit(2, reservesSpace: true)
.truncationMode(.middle)
}
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.gridCellColumns(4)
.padding()
.background(.regularMaterial)
}
}
.background(
LinearGradient(gradient: Gradient(colors: [color.darken(by: -0.2), color.darken(by: 0.1)]), startPoint: .topLeading, endPoint: .bottomTrailing)
)
}
}