split views into subview
This commit is contained in:
46
iphone/Werkout_ios/subview/RateWorkoutView.swift
Normal file
46
iphone/Werkout_ios/subview/RateWorkoutView.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// RateWorkoutView.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 6/18/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RateWorkoutView: View {
|
||||
@Binding var difficulty: Float
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Divider()
|
||||
|
||||
HStack {
|
||||
Text("No Rate")
|
||||
.foregroundColor(.black)
|
||||
Text("Easy")
|
||||
.foregroundColor(.green)
|
||||
Spacer()
|
||||
Text("Death")
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
|
||||
ZStack {
|
||||
LinearGradient(
|
||||
gradient: Gradient(colors: [.black, .green, .red]),
|
||||
startPoint: .leading,
|
||||
endPoint: .trailing
|
||||
)
|
||||
.mask(Slider(value: $difficulty, in: 0...5, step: 1))
|
||||
|
||||
// Dummy replicated slider, to allow sliding
|
||||
Slider(value: $difficulty, in: 0...5, step: 1)
|
||||
.opacity(0.05) // Opacity is the trick here.
|
||||
.accentColor(.clear)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#Preview {
|
||||
// RateWorkoutView()
|
||||
//}
|
||||
Reference in New Issue
Block a user