自定义形状,
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NavigationPageView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
struct NavigationPageView<T: View>: View {
|
||||
@Environment(\.presentationMode) private var presentationMode
|
||||
var title: String = ""
|
||||
var content: any View
|
||||
var content: T?
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
AnyView(content)
|
||||
content
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationTitle(title)
|
||||
@@ -22,7 +22,7 @@ struct NavigationPageView: View {
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button {
|
||||
dismiss()
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
} label: {
|
||||
HStack {
|
||||
Image(systemName: "chevron.backward")
|
||||
|
||||
@@ -13,6 +13,9 @@ struct TabBarView: View {
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color.gray.opacity(0.2))
|
||||
.ignoresSafeArea()
|
||||
Group {
|
||||
switch selectedTab {
|
||||
case .home:
|
||||
@@ -34,10 +37,7 @@ struct TabBarView: View {
|
||||
VStack(spacing: 6) {
|
||||
Image(systemName: item.icon).resizable().frame(width: 18, height: 18)
|
||||
Text(item.text)
|
||||
.font(.caption)
|
||||
.fontWeight(.regular)
|
||||
.multilineTextAlignment(.center)
|
||||
.lineLimit(1)
|
||||
.navBarText()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
@@ -46,12 +46,11 @@ struct TabBarView: View {
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 12.0)
|
||||
.background(Color("TabBarColor"))
|
||||
.background(Color("TabBarColor").ignoresSafeArea())
|
||||
.frame(maxHeight: .infinity, alignment: .bottom)
|
||||
.shadow(color: Color.gray.opacity(0.5), radius: 6, x: 0, y: 6)
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.columns)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user