页面uodate

This commit is contained in:
2024-01-26 17:52:25 +08:00
parent 6f7f8deda1
commit fdc1b1c18f
10 changed files with 161 additions and 46 deletions

View File

@@ -9,7 +9,9 @@ import SwiftUI
struct CouponView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
ZStack {
Text("Coupon view")
}
}
}

View File

@@ -11,6 +11,12 @@ struct UserView: View {
@State private var showDetail = false
@State private var showUserInfo = false
var grayBackground = Color.gray.opacity(0.2)
init() {
print(UIScreen.main.bounds.width)
}
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
@@ -23,7 +29,6 @@ struct UserView: View {
Recommend
}
}
.padding(.bottom, 48)
.animation(.spring, value: showDetail)
}
@@ -86,7 +91,6 @@ struct UserView: View {
RoundedRectangle(cornerRadius: 12)
.offset(y: 12)
)
.padding(.horizontal, 12)
}
@@ -101,9 +105,29 @@ struct UserView: View {
}
}
}
.padding(.horizontal, 12)
}
.padding(12)
.background(Color.gray.opacity(0.2))
.padding(.top, 12)
.background(
Color.white
.overlay(alignment: .top) {
RoundedRectangle(cornerRadius: 12)
.fill(LinearGradient(colors: [Color.orange.opacity(0.3), grayBackground], startPoint: .top, endPoint: .bottom))
.frame(height: 92)
}
)
.clipped()
// Rectangle()
// .fill(Color.white)
// .frame(height: 12)
// .overlay {
// RoundedRectangle(cornerRadius: 12)
// .fill(grayBackground)
// .frame(height: 24)
// .offset(y: 6)
// }
// .clipped()
}
var Notice: some View {
@@ -142,8 +166,8 @@ struct UserView: View {
.background(Color.white)
.cornerRadius(8)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
.padding(.vertical, 12)
.background(grayBackground)
}
var OrderShow: some View {
@@ -197,7 +221,7 @@ struct UserView: View {
.cornerRadius(6)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
.background(grayBackground)
}
var Coupons: some View {
@@ -205,25 +229,29 @@ struct UserView: View {
HStack {
Spacer()
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
VStack {
Image(systemName: "wallet.pass")
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(Color.gray)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red.opacity(0.9))
.frame(width: 20, height: 20)
.overlay {
Text("5")
.foregroundColor(Color.white)
.font(.system(size: 12))
}
.offset(x: 12, y: -10)
}
Text("待付款")
.font(.system(size: 12))
.foregroundColor(Color.gray)
NavigationLink {
CouponView()
} label: {
VStack {
Image(systemName: "wallet.pass")
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(Color.gray)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red.opacity(0.9))
.frame(width: 20, height: 20)
.overlay {
Text("5")
.foregroundColor(Color.white)
.font(.system(size: 12))
}
.offset(x: 12, y: -10)
}
Text("待付款")
.font(.system(size: 12))
.foregroundColor(Color.gray)
}
}
Spacer()
}
@@ -235,7 +263,7 @@ struct UserView: View {
.cornerRadius(6)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
.background(grayBackground)
}
let columns = [GridItem(.flexible(), spacing: 12), GridItem(.flexible(), spacing: 12)]
@@ -262,7 +290,7 @@ struct UserView: View {
}
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
.background(grayBackground)
}
}