商品详情页

This commit is contained in:
2024-01-29 17:55:09 +08:00
parent fdc1b1c18f
commit 5109b242a6
6 changed files with 102 additions and 9 deletions

View File

@@ -8,15 +8,107 @@
import SwiftUI
struct GoodsDetailView: View {
var body: some View {
NavigationPageView(title: "商品详情", content: content)
}
@Environment(\.dismiss) private var dismiss
var title: String
var content: some View {
Image("Images/banner1")
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 {
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)
}
.background(Color.gray.opacity(0.2))
// .navigationBarTitleDisplayMode(.inline)
// .navigationTitle(title)
// .navigationBarBackButtonHidden(true)
// .toolbar {
// ToolbarItem(placement: .navigationBarLeading) {
// Button {
// dismiss()
// } label: {
// HStack {
// Image(systemName: "chevron.backward")
// }
// }
// }
// }
}
}
#Preview {
GoodsDetailView()
GoodsDetailView(title: "Test")
}