gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 41/204: ScopePicker


From: gnunet
Subject: [taler-taler-ios] 41/204: ScopePicker
Date: Thu, 05 Dec 2024 23:50:09 +0100

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 acf36f6af1c6641a65ffed578375b62eadbb7252
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 12 11:20:12 2024 +0200

    ScopePicker
---
 TalerWallet1/Helper/Font+Taler.swift             |  1 +
 TalerWallet1/Views/HelperViews/ScopePicker.swift | 32 +++++++++++-------------
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/TalerWallet1/Helper/Font+Taler.swift 
b/TalerWallet1/Helper/Font+Taler.swift
index 7408719..c307778 100644
--- a/TalerWallet1/Helper/Font+Taler.swift
+++ b/TalerWallet1/Helper/Font+Taler.swift
@@ -174,6 +174,7 @@ extension TalerFont {   // old running
     static var title:       TalerFont { TalerFont(fontName, size: 28, 
relativeTo: .title) }       // 28 -> 31
     static var title2:      TalerFont { TalerFont(fontName, size: 22, 
relativeTo: .title2) }      // 22 -> 25
     static var title3:      TalerFont { TalerFont(fontName, size: 20, 
relativeTo: .title3) }      // 20 -> 23
+    static var picker:      TalerFont { TalerFont(fontName, size: 18, 
relativeTo: .body) }        // picker uses a different size!
     static var headline:    TalerFont { TalerFont(fontName, size: 17, 
relativeTo: .headline, isBold: true) } // 17 bold -> 19 bold
     static var body:        TalerFont { TalerFont(fontName, size: 17, 
relativeTo: .body) }        // 17 -> 19
     static var callout:     TalerFont { TalerFont(fontName, size: 16, 
relativeTo: .callout) }     // 16 -> 18
diff --git a/TalerWallet1/Views/HelperViews/ScopePicker.swift 
b/TalerWallet1/Views/HelperViews/ScopePicker.swift
index 8d66090..94afc09 100644
--- a/TalerWallet1/Views/HelperViews/ScopePicker.swift
+++ b/TalerWallet1/Views/HelperViews/ScopePicker.swift
@@ -19,34 +19,32 @@ struct ScopePicker: View {
         return amount.formatted(isNegative: false, useISO: false)
     }
 
-    func label(balance: Balance) -> String {
-        let label = balance.scopeInfo.url?.trimURL
-                 ?? balance.scopeInfo.currency
-        return String("\(label):\t\(formattedAmount(balance).nbs)")
+    func row(_ balance: Balance) -> String {
+        let urlOrCurrency = balance.scopeInfo.url?.trimURL
+        ?? balance.scopeInfo.currency
+        return String("\(urlOrCurrency):\t\(formattedAmount(balance).nbs)")
     }
 
     var body: some View {
-        HStack {
-            Text("Use: ", comment: "ScopePicker")
-            Spacer()
-            if (balances.count > 0) {
+        if (balances.count > 0) {
+            Group {
                 Picker(EMPTYSTRING, selection: $selected) {
                     ForEach(0..<balances.count, id: \.self) { index in
-                        Text(label(balance: balances[index]))
+                        Text(row(balances[index]))
                             .tag(index)
                     }
                 }
+                .frame(width: .infinity)
                 .pickerStyle(.menu)
-                .onAppear() {
-                    withAnimation { selected = value }
-                }
-                .onChange(of: selected) { newValue in
-                    action(newValue)
-                }
+                .labelsHidden()
+            }
+            .onAppear() {
+                withAnimation { selected = value }
+            }
+            .onChange(of: selected) { newValue in
+                action(newValue)
             }
         }
-        .padding(.leading)
-        .talerFont(.title3)
     }
 }
 // MARK: -

-- 
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]