pushdeer/ios/PushDeer-iOS/PushDeer/View/Common/BaseNavigationView.swift

51 lines
1.1 KiB
Swift

//
// BaseNavigationView.swift
// PushDeer
//
// Created by HEXT on 2021/12/26.
//
import SwiftUI
/// View, APP使
struct BaseNavigationView<Content : View> : View {
///
let title: LocalizedStringKey
/// View
@ViewBuilder let contentView: Content
@Environment(\.colorScheme) private var colorScheme
var body: some View {
NavigationView {
ZStack {
// VStack HStack Spacer
VStack {
HStack {
Spacer()
}
Spacer()
}
contentView
}
.background(
Image("deer.gray")
.offset(x: -150, y: -10)
.opacity(colorScheme == .dark ? 0.4 : 1),
alignment: .bottom
)
.navigationBarTitle(title)
}
.navigationViewStyle(.stack)
}
}
struct BaseNavigationView_Previews: PreviewProvider {
static var previews: some View {
BaseNavigationView(title: "标题") {
Text("内容")
}
.environment(\.colorScheme, .dark)
}
}