115 lines
3.8 KiB
Swift
115 lines
3.8 KiB
Swift
//
|
|
// GoodsDetail.swift
|
|
// demo
|
|
//
|
|
// Created by Jason on 2024/1/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct GoodsDetailView: View {
|
|
@Environment(\.dismiss) private var dismiss
|
|
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 {
|
|
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(title: "Test")
|
|
}
|