I have created a login page but I am trying to add a view to encapsulate the textfield and add a blur effect.
Below is the current code I have:
var body: some View {
ZStack() {
VStack(spacing: 16) {
Spacer()
VStack(spacing: 16) {
InputTextFieldView(text: $viewModel.credentials.email,
placeholder: "Email",
keyboardType: .emailAddress,
sfSymbol: "envelope")
InputPasswordView(password: $viewModel.credentials.password,
placeholder: "Password",
sfSymbol: "lock")
}
HStack {
Spacer()
Button(action: {
showForgotPassword.toggle()
}, label: {
Text("Forgot Password?")
})
.font(.system(size: 16, weight: .bold))
.sheet(isPresented: $showForgotPassword, content:{
ForgotPasswordView()
})
}
VStack(spacing: 16) {
ButtonView(title: "Login") {
viewModel.login()
}
HStack {
Text("Need an account? ")
Button(action: {
showRegistration.toggle()
}, label: {
Text("Signup")
})
.font(.system(size: 16, weight: .bold))
.sheet(isPresented: $showRegistration, content:{
RegisterView()
})
}
}
}
.padding(.horizontal, 15)
// .frame(height: .infinity, alignment: .bottom)
}
.navigationTitle("SignIn")
}
The screen look like:
But I am trying to achieve this:
Do not pay attention to the background image, I will use a Zstack
to achieve this. I’m mostly looking to achieve the bottom container.
Any idea ?
2
Answers
A simple solution would be to just use the
.ultraThinMaterial
colour and change the brightness for the background.Image I used:
The result:
Try to use this method using
ZStack
Usage