components: create PinkGradientView and use PinkGradient directly
Still need to do this for the other gradients as well but this is fine for now.
This commit is contained in:
@@ -14,7 +14,7 @@ struct GradientButtonStyle: ButtonStyle {
|
|||||||
.foregroundColor(Color.white)
|
.foregroundColor(Color.white)
|
||||||
.background {
|
.background {
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.fill(PinkGradient.gradient)
|
.fill(PinkGradient)
|
||||||
}
|
}
|
||||||
.scaleEffect(configuration.isPressed ? 0.8 : 1)
|
.scaleEffect(configuration.isPressed ? 0.8 : 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,20 +11,18 @@ fileprivate let damus_grad_c1 = hex_col(r: 0xd3, g: 0x4c, b: 0xd9)
|
|||||||
fileprivate let damus_grad_c2 = hex_col(r: 0xf8, g: 0x69, b: 0xb6)
|
fileprivate let damus_grad_c2 = hex_col(r: 0xf8, g: 0x69, b: 0xb6)
|
||||||
fileprivate let pink_grad = [damus_grad_c1, damus_grad_c2]
|
fileprivate let pink_grad = [damus_grad_c1, damus_grad_c2]
|
||||||
|
|
||||||
struct PinkGradient: View {
|
let PinkGradient = LinearGradient(colors: pink_grad, startPoint: .topTrailing, endPoint: .bottom)
|
||||||
|
|
||||||
|
struct PinkGradientView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
PinkGradient.gradient
|
PinkGradient
|
||||||
.edgesIgnoringSafeArea([.top,.bottom])
|
.edgesIgnoringSafeArea([.top,.bottom])
|
||||||
}
|
}
|
||||||
|
|
||||||
static var gradient: LinearGradient {
|
|
||||||
LinearGradient(colors: pink_grad, startPoint: .topTrailing, endPoint: .bottom)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PinkGradient_Previews: PreviewProvider {
|
struct PinkGradientView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
PinkGradient()
|
PinkGradientView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user