wip
This commit is contained in:
parent
473cf3b30b
commit
633b4fa2b0
|
@ -19,6 +19,8 @@ struct WelcomeScreen: View {
|
|||
.tappablePadding(.symmetric(10)) {
|
||||
router.showScreen(.push) { _ in
|
||||
SettingsScreen()
|
||||
.environment(\.settingsParent, .welcome)
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ struct MainTabScreen: View {
|
|||
|
||||
case .settings:
|
||||
SettingsScreen()
|
||||
.environment(\.settingsParent, .main)
|
||||
}
|
||||
|
||||
// Tab bar
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
import SwiftUI
|
||||
|
||||
enum SettingsScreenParent {
|
||||
case main
|
||||
case welcome
|
||||
}
|
||||
|
||||
struct SettingsScreenParentKey: EnvironmentKey {
|
||||
static let defaultValue = SettingsScreenParent.main
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
var settingsParent: SettingsScreenParent {
|
||||
get { self[SettingsScreenParentKey.self] }
|
||||
set { self[SettingsScreenParentKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsScreen: View {
|
||||
@EnvironmentObject var clientsStore: ClientsStore
|
||||
@Environment(\.router) var router
|
||||
@Environment(\.settingsParent) var parent
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
|
@ -13,9 +30,21 @@ struct SettingsScreen: View {
|
|||
// Content
|
||||
VStack(spacing: 0) {
|
||||
// Header
|
||||
SharedNavigationBar(
|
||||
centerText: .init(text: L10n.Settings.Main.title)
|
||||
)
|
||||
if parent == .main {
|
||||
SharedNavigationBar(
|
||||
centerText: .init(text: L10n.Settings.Main.title)
|
||||
)
|
||||
} else {
|
||||
SharedNavigationBar(
|
||||
leftButton: .init(
|
||||
image: Image(systemName: "chevron.left"),
|
||||
action: {
|
||||
router.dismissScreen()
|
||||
}
|
||||
),
|
||||
centerText: .init(text: L10n.Settings.Main.title)
|
||||
)
|
||||
}
|
||||
|
||||
// List
|
||||
List {
|
||||
|
|
Loading…
Reference in a new issue