gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]