admin管理员组文章数量:1291177
I am trying to give blur, opacity (0.8) with white color the the background of the Text so that when i scroll the content appear blured behind the text Container. I tried background(.ultraThinMaterial) but it has by default gray color and the requirment of blur with white color, and applied background(Color.white).opacity(0.8).blur(radius:) but this is applying background color to the blur
var body: some View {
ZStack {
ScrollView{
Capsule()
.frame(width: 270,height: 120)
.padding(.top , 10)
Capsule()
.frame(width: 270,height: 120)
.padding(.top , 10)
Capsule()
.frame(width: 270,height: 120)
.padding(.top , 10)
VStack(alignment: .leading){
Text("Reach your goals faster by saving more every month")
.font(.system(size: 20))
.fontWeight(.bold)
.multilineTextAlignment(.center)
.padding()
.legoForegroundColor(tokens.semantic.color.brand.primary)
Spacer()
.frame(height : 37)
Text("My Active SIPs")
.font(.title3)
.bold()
.padding(.top , 10)
ForEach(SipDetails, id: \.self){ SipDetail in
SipDetailsCardView(SipDetails: SipDetail)
//.background(Color.pink)
.cornerRadius(20)
}
}
}
ZStack {
VStack(spacing: 0) {
HStack(alignment: .center) {
Text("this is example app")
}
.frame(maxWidth: .infinity)
}
// .readSize($viewHeight)
}
// .background(Color.clear)
.background(content: {
ZStack {
VisualEffectView(effect: UIBlurEffect(style: .systemUltraThinMaterialLight),
blendingColor: UIColor.white.withAlphaComponent(0.8))
}
})
.frame(height: 56)
.padding()
}
}
this is the implementation of VisualEffect and tried all the possible combination here as well but all of them applying opacity with white color not blur
struct VisualEffectView: UIViewRepresentable {
var effect: UIVisualEffect
var blendingColor: UIColor // Blending color
func makeUIView(context: UIViewRepresentableContext<Self>) -> UIVisualEffectView {
let view = UIVisualEffectView(effect: UIBlurEffect(style: .systemUltraThinMaterialLight))
view.backgroundColor = .clear
view.contentView.backgroundColor = .clear//blendingColor
view.contentView.alpha = 0.8
return view
}
func updateUIView(_ uiView: UIVisualEffectView,
context: UIViewRepresentableContext<Self>) {
uiView.effect = effect
uiView.backgroundColor = blendingColor
}
}
本文标签: swiftstrugle to get bluropacity all with white Backgroundcolor in swiftUIStack Overflow
版权声明:本文标题:swift - strugle to get blur, opacity all with white Backgroundcolor in swiftUI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741526962a2383525.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论