102 lines
3.2 KiB
Swift
102 lines
3.2 KiB
Swift
//
|
|
// GoodsDetail.swift
|
|
// demo
|
|
//
|
|
// Created by Jason on 2024/1/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct GoodsDetailView: View {
|
|
@Environment(\.presentationMode) private var presentationMode
|
|
var title: String
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Button {
|
|
presentationMode.wrappedValue.dismiss()
|
|
} label: {
|
|
Image(systemName: "chevron.backward")
|
|
}
|
|
.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))
|
|
.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)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
GoodsDetailView(title: "Test")
|
|
}
|