页面uodate
This commit is contained in:
@@ -22,12 +22,10 @@ struct HomeView: View {
|
||||
PartyReading
|
||||
NewBooks
|
||||
Categories
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.bottom, 48)
|
||||
.background(Color.gray.opacity(0.2))
|
||||
}
|
||||
|
||||
|
||||
@@ -12,23 +12,19 @@ struct TabBarView: View {
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack(alignment: .leading) {
|
||||
ZStack {
|
||||
Group {
|
||||
switch selectedTab {
|
||||
case .home:
|
||||
HomeView()
|
||||
case .explore:
|
||||
MallView()
|
||||
case .message:
|
||||
MessageView()
|
||||
case .cart:
|
||||
CartView()
|
||||
case .account:
|
||||
UserView()
|
||||
}
|
||||
}
|
||||
// .offset(y: -64)
|
||||
// .safeAreaInset(edge: .top) {
|
||||
// Color.clear.frame(height: 32)
|
||||
// }
|
||||
|
||||
HStack {
|
||||
ForEach(tabItems) { item in
|
||||
@@ -49,14 +45,11 @@ struct TabBarView: View {
|
||||
.shadow(color: selectedTab == item.tab ? Color.orange : Color.blue, radius: 15)
|
||||
}
|
||||
}
|
||||
.padding(.top, 12.0)
|
||||
.padding(.bottom, 32)
|
||||
.padding(.vertical, 12.0)
|
||||
.background(Color("TabBarColor"))
|
||||
.frame(maxHeight: .infinity, alignment: .bottom)
|
||||
.shadow(color: Color.gray.opacity(0.5), radius: 6, x: 0, y: 6)
|
||||
.ignoresSafeArea()
|
||||
}
|
||||
.statusBarHidden(false)
|
||||
}
|
||||
.navigationViewStyle(.columns)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,67 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CartView: View {
|
||||
@State private var isCheckAll = false
|
||||
@State private var canSettle: Bool = false
|
||||
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 2) {
|
||||
Text("购物车")
|
||||
.font(.system(size: 18))
|
||||
Text("(12)")
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color.gray)
|
||||
Spacer()
|
||||
Text("管理")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(Color.black)
|
||||
.onTapGesture {
|
||||
canSettle.toggle()
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.bottom, 12)
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(spacing: 12) {
|
||||
ForEach(0 ..< 22) { _ in
|
||||
Rectangle()
|
||||
.fill(Color.white)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 100)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 12)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 12)
|
||||
|
||||
HStack(alignment: .center, spacing: 4) {
|
||||
RadioButton(checked: $isCheckAll, label: "全选")
|
||||
Spacer()
|
||||
Text("合计")
|
||||
.font(.system(size: 14))
|
||||
CamelPrice(amount: 0)
|
||||
Text("结 算")
|
||||
.font(.system(size: 14))
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.vertical, 12)
|
||||
.foregroundColor(Color.white)
|
||||
.background(
|
||||
LinearGradient(colors: [
|
||||
canSettle ? Color.orange : Color.gray.opacity(0.5),
|
||||
canSettle ? Color.red : Color.gray,
|
||||
], startPoint: .leading, endPoint: .trailing)
|
||||
)
|
||||
.cornerRadius(32)
|
||||
.onTapGesture {}
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
}
|
||||
.animation(.linear(duration: 10), value: isCheckAll)
|
||||
.padding(.bottom, 62)
|
||||
.background(Color.gray.opacity(0.2))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ import SwiftUI
|
||||
|
||||
struct MallView: View {
|
||||
var body: some View {
|
||||
Text("Mall Page")
|
||||
ZStack(alignment: .topLeading) {
|
||||
Text("Mall")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user