自定义形状,

This commit is contained in:
2024-01-30 18:06:53 +08:00
parent 5109b242a6
commit 073ff4aa68
11 changed files with 194 additions and 153 deletions

View File

@@ -68,7 +68,6 @@ struct CartView: View {
}
.animation(.linear(duration: 10), value: isCheckAll)
.padding(.bottom, 62)
.background(Color.gray.opacity(0.2))
}
}

View File

@@ -8,104 +8,91 @@
import SwiftUI
struct GoodsDetailView: View {
@Environment(\.dismiss) private var dismiss
@Environment(\.presentationMode) private var presentationMode
var title: String
var body: some View {
ZStack {
ScrollView {
VStack {
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
Image("Images/banner1")
.resizable()
.scaledToFit()
}
HStack {
Text(title)
CamelPrice(amount: 32.112)
}
VStack {
Text("商品详情部分")
}
}
}
.padding(.bottom, 100)
.ignoresSafeArea(.all)
HStack {
HStack {
Button {
presentationMode.wrappedValue.dismiss()
} label: {
Image(systemName: "chevron.backward")
Spacer()
Image(systemName: "ellipsis")
}
.padding(12.0)
.background(LinearGradient(colors: [Color.white, Color.white.opacity(0)], startPoint: .top, endPoint: .bottom))
.frame(maxHeight: .infinity, alignment: .top)
HStack(spacing: 0) {
HStack(spacing: 8) {
Image(systemName: "house")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "person.fill.questionmark")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "star")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "cart")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
}
Spacer()
HStack(spacing: 12) {
Button {} label: {
Text("加入购物车")
.font(.system(size: 15))
.foregroundColor(Color.white)
}
Rectangle()
.fill(Color.white)
.frame(width: 1, height: 14)
Button {} label: {
Text("立即购买")
.font(.system(size: 15))
.foregroundColor(Color.white)
}
}
.padding(.vertical, 12)
.padding(.horizontal, 24)
.background(LinearGradient(colors: [Color.orange, Color.red], startPoint: .leading, endPoint: .trailing))
.clipShape(
RoundedRectangle(cornerRadius: 24)
)
}
.padding(12.0)
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
.background(Color("TabBarColor"))
.frame(maxHeight: .infinity, alignment: .bottom)
.accentColor(Color.black)
Text(title)
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
Image(systemName: "ellipsis")
}
.padding(.horizontal, 12.0)
ScrollView {
VStack {
Image("Images/banner1")
.resizable()
.scaledToFit()
HStack {
Text(title)
CamelPrice(amount: 32.112)
}
VStack {
Text("商品详情部分")
}
}
}
.background(Color.gray.opacity(0.2))
// .navigationBarTitleDisplayMode(.inline)
// .navigationTitle(title)
// .navigationBarBackButtonHidden(true)
// .toolbar {
// ToolbarItem(placement: .navigationBarLeading) {
// Button {
// dismiss()
// } label: {
// HStack {
// Image(systemName: "chevron.backward")
// }
// }
// }
// }
.ignoresSafeArea()
// .background(Color.white)
// .background(LinearGradient(colors: [Color.white, Color.white.opacity(0)], startPoint: .top, endPoint: .bottom))
HStack(spacing: 0) {
HStack(spacing: 12) {
Image(systemName: "house")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "person.fill.questionmark")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "star")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
Image(systemName: "cart")
.resizable()
.foregroundColor(Color.gray)
.frame(width: 20, height: 18)
}
Spacer()
HStack(spacing: 12) {
Button {} label: {
Text("加入购物车")
.font(.system(size: 14))
.foregroundColor(Color.white)
}
Rectangle()
.fill(Color.white)
.frame(width: 0.4, height: 14)
Button {} label: {
Text("立即购买")
.font(.system(size: 14))
.foregroundColor(Color.white)
}
}
.padding(.vertical, 10)
.padding(.horizontal, 24)
.background(LinearGradient(colors: [Color.orange, Color.red], startPoint: .leading, endPoint: .trailing))
.clipShape(
RoundedRectangle(cornerRadius: 24)
)
}
.padding(.horizontal, 12.0)
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
.background(Color("TabBarColor"))
.navigationBarBackButtonHidden(true)
}
}