mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-18 05:22:11 +00:00
Progress on onboaring view.
This commit is contained in:
parent
e2f519987f
commit
005bb70b6a
@ -6,8 +6,9 @@ struct SetupView: View {
|
||||
@Binding var visible: Bool
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
VStack {
|
||||
StepView(numberOfSteps: 3, currentStep: stepIndex)
|
||||
StepView(numberOfSteps: 3, currentStep: stepIndex, width: 500)
|
||||
GeometryReader { proxy in
|
||||
HStack {
|
||||
SecretAgentSetupView(buttonAction: advance)
|
||||
@ -23,9 +24,11 @@ struct SetupView: View {
|
||||
.animation(.spring())
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(idealWidth: 500, idealHeight: 500)
|
||||
}
|
||||
|
||||
|
||||
func advance() {
|
||||
stepIndex += 1
|
||||
}
|
||||
@ -47,11 +50,18 @@ struct StepView: View {
|
||||
let numberOfSteps: Int
|
||||
let currentStep: Int
|
||||
|
||||
// Ideally we'd have a geometry reader inside this view doing this for us, but that crashes on 11.0b7
|
||||
let width: CGFloat
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
ZStack(alignment: .leading) {
|
||||
Rectangle()
|
||||
.foregroundColor(.blue)
|
||||
.frame(height: 5)
|
||||
Rectangle()
|
||||
.foregroundColor(.green)
|
||||
.frame(width: max(0, (width / CGFloat(numberOfSteps - 1)) * CGFloat(currentStep) - 15), height: 5)
|
||||
.animation(.spring())
|
||||
HStack {
|
||||
ForEach(0..<numberOfSteps) { index in
|
||||
ZStack {
|
||||
@ -64,10 +74,15 @@ struct StepView: View {
|
||||
.bold()
|
||||
} else {
|
||||
Circle()
|
||||
.foregroundColor(currentStep == index ? .white : .blue)
|
||||
.foregroundColor(.blue)
|
||||
.frame(width: 30, height: 30)
|
||||
if currentStep == index {
|
||||
Circle()
|
||||
.strokeBorder(Color.white, lineWidth: 3)
|
||||
.frame(width: 30, height: 30)
|
||||
}
|
||||
Text(String(describing: index + 1))
|
||||
.foregroundColor(currentStep == index ? .blue : .white)
|
||||
.foregroundColor(.white)
|
||||
.bold()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user