[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 15/28: Speed up Sidebar
From: |
gnunet |
Subject: |
[taler-taler-ios] 15/28: Speed up Sidebar |
Date: |
Tue, 19 Sep 2023 03:44:34 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 9f7b1e5e1018b8d9742b0c7ad8c55fe2245dd013
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Sep 10 13:31:16 2023 +0200
Speed up Sidebar
---
TalerWallet1/Views/Main/MainView.swift | 23 ++++++++++++++++++-----
TalerWallet1/Views/Main/SideBarView.swift | 15 ++++++++-------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 54cc48d..9fd7a1c 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -71,7 +71,9 @@ extension MainView {
@Binding var talerFont: Int
@State var sidebarVisible: Bool = false
func hamburgerAction() {
- sidebarVisible = !sidebarVisible
+ withAnimation(.easeInOut(duration: 0.25)) {
+ sidebarVisible = !sidebarVisible
+ }
}
let balances = String(localized: "Balances")
@@ -108,13 +110,24 @@ extension MainView {
.id(views[currentView].name)
.frame(maxWidth: .infinity, maxHeight: .infinity,
alignment: .center)
.transition(.backslide)
- }
+ } .id(talerFont)
.navigationBarTitleDisplayMode(.automatic)
- }.navigationViewStyle(.stack)
- // The side view is on top of the current view
+ .background(NavigationBarBuilder {
navigationController in
+ //
navigationController.navigationBar.barTintColor = .red
+
navigationController.navigationBar.titleTextAttributes =
+ [.font: TalerFont.talerFont(talerFont, size:
24, relativeTo: .title2)]
+
navigationController.navigationBar.largeTitleTextAttributes =
+ [.font: TalerFont.talerFont(talerFont, size:
38, relativeTo: .largeTitle)]
+ })
+ }
+ .navigationViewStyle(.stack)
+ .talerNavBar(talerFont: talerFont)
+
+ // The side view is above (Z-Axis) the current view
SideBarView(views: views,
currentView: $currentView,
- sidebarVisible: $sidebarVisible)
+ sidebarVisible: sidebarVisible,
+ hamburgerAction: hamburgerAction)
}
}
} // Content
diff --git a/TalerWallet1/Views/Main/SideBarView.swift
b/TalerWallet1/Views/Main/SideBarView.swift
index 628de3f..3a21133 100644
--- a/TalerWallet1/Views/Main/SideBarView.swift
+++ b/TalerWallet1/Views/Main/SideBarView.swift
@@ -17,7 +17,8 @@ struct SideBarView: View {
private let symLog = SymLogV(0)
let views: [SidebarItem]
@Binding var currentView: Int
- @Binding var sidebarVisible: Bool
+ let sidebarVisible: Bool
+ let hamburgerAction: () -> Void
@State private var rotationEnabled = false
var body: some View {
@@ -35,8 +36,8 @@ struct SideBarView: View {
ForEach(0..<views.count, id: \.self) { i in
Button {
symLog.log("sidebar item \"\(views[i].name)\"
selected")
- sidebarVisible = false // slide sidebar to
the left
- withAnimation(.easeInOut) {currentView = i}
// switch to the view the user selected
+ hamburgerAction() // slide sidebar to the left
+ withAnimation(.easeInOut(duration: 0.3))
{currentView = i} // animate to the view the user selected
} label: {
if let sysImage = views[i].sysImage {
Label(views[i].name, systemImage: sysImage)
@@ -68,11 +69,9 @@ struct SideBarView: View {
.offset(x: sidebarVisible ? sidebarWidth : 0)
.contentShape(Rectangle())
.onTapGesture {
- sidebarVisible = false
+ hamburgerAction() // slide sidebar to the left
}
}
- .animation(.linear //(duration: SLIDEDURATION)
- , value: sidebarVisible)
}
}
// MARK: -
@@ -86,7 +85,9 @@ fileprivate struct BindingViewContainer : View {
ZStack(alignment: .leading) {
views[currentView].view
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment:
.center)
- SideBarView(views: views, currentView: $currentView,
sidebarVisible: $sidebarVisible)
+ SideBarView(views: views, currentView: $currentView,
+ sidebarVisible: sidebarVisible,
+ hamburgerAction: { sidebarVisible = !sidebarVisible })
}
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 01/28: Haptics, (continued)
- [taler-taler-ios] 01/28: Haptics, gnunet, 2023/09/18
- [taler-taler-ios] 08/28: Binding+onChange, gnunet, 2023/09/18
- [taler-taler-ios] 10/28: ExchangeTosStatus, gnunet, 2023/09/18
- [taler-taler-ios] 03/28: talerFonts, gnunet, 2023/09/18
- [taler-taler-ios] 09/28: move AgePicker, gnunet, 2023/09/18
- [taler-taler-ios] 13/28: Comment, gnunet, 2023/09/18
- [taler-taler-ios] 06/28: Black, gnunet, 2023/09/18
- [taler-taler-ios] 14/28: ToSButton, gnunet, 2023/09/18
- [taler-taler-ios] 07/28: DebugView static font size, gnunet, 2023/09/18
- [taler-taler-ios] 12/28: Italic, gnunet, 2023/09/18
- [taler-taler-ios] 15/28: Speed up Sidebar,
gnunet <=
- [taler-taler-ios] 11/28: AccessibleFont, gnunet, 2023/09/18
- [taler-taler-ios] 28/28: !!! Temporarily add back old cases to ExchangeTosStatus to be able to run with older wallet-core version !!!, gnunet, 2023/09/18
- [taler-taler-ios] 27/28: simplify log, gnunet, 2023/09/18
- [taler-taler-ios] 18/28: MainActor for Swift 6, gnunet, 2023/09/18
- [taler-taler-ios] 05/28: Terms of Service, gnunet, 2023/09/18
- [taler-taler-ios] 16/28: ScreenSize, gnunet, 2023/09/18
- [taler-taler-ios] 22/28: CallStack, gnunet, 2023/09/18
- [taler-taler-ios] 23/28: logging, gnunet, 2023/09/18
- [taler-taler-ios] 26/28: fix warning, gnunet, 2023/09/18
- [taler-taler-ios] 21/28: test.taler.net now uses KUDOS (instead of TESTKUDOS), gnunet, 2023/09/18