Implemented showing balance in AllBanksListItem, BankAccountListItem and BankListItem; extracted AmountLabel for that

This commit is contained in:
dankito 2020-07-28 11:03:39 +02:00
parent 4340b80925
commit ca214457ca
7 changed files with 41 additions and 10 deletions

View File

@ -38,13 +38,13 @@ struct ContentView: View {
TanMedium(displayName: "Handy mit Nummer 0170 / 12345678", status: .available) TanMedium(displayName: "Handy mit Nummer 0170 / 12345678", status: .available)
] ]
self.enterTanState = EnterTanState(customer, TanChallenge(messageToShowToUser: "Gib die TAN ein du faules Stueck!", tanProcedure: selectedTanProcedure)) { result in } self.enterTanState = EnterTanState(customer, TanChallenge(messageToShowToUser: "Gib die TAN ein du faules Stueck!\nAber jetzt manchen wir mal eine richtig, richtig lange Nachricht daraus.\nMal schauen, ob mir so viel Quatsch ueberhaupt einfaellt (aber anscheinend scheine ich sehr kreativ zu sein).", tanProcedure: selectedTanProcedure)) { result in }
} }
var body: some View { var body: some View {
// NavigationView { // NavigationView {
VStack { // VStack {
TabView(selection: $selection) { TabView(selection: $selection) {
AccountsTab(data: data) AccountsTab(data: data)
.onAppear { .onAppear {
@ -121,13 +121,15 @@ struct ContentView: View {
} }
.tag(1) .tag(1)
NavigationView { EnterTanDialog(self.enterTanState) } EnterTanDialog(self.enterTanState)
.tabItem { .tabItem {
VStack { VStack {
Text("EnterTanDialog") Text("EnterTanDialog")
} }
} }
.tag(2) .tag(3)
.navigationBarHidden(false)
.navigationBarTitle("Enter TAN")
} }
.navigationBarHidden(false) .navigationBarHidden(false)
@ -135,8 +137,9 @@ struct ContentView: View {
.navigationBarItems(leading: leadingNavigationBarItem) .navigationBarItems(leading: leadingNavigationBarItem)
} // }
.hideNavigationBar() //.hideNavigationBar()
//.navigationViewStyle(StackNavigationViewStyle()) // see https://stackoverflow.com/questions/59338711/swiftui-bug-navigationview-and-list-not-showing-on-ipad-simulator-only
// } // }
} }
} }

View File

@ -0,0 +1,23 @@
import SwiftUI
import BankingUiSwift
struct AmountLabel: View {
let amount: CommonBigDecimal
@Inject private var presenter: BankingPresenterSwift
var body: some View {
Text(presenter.formatAmount(amount: amount))
.styleAmount(amount: amount)
}
}
struct AmountLabel_Previews: PreviewProvider {
static var previews: some View {
AmountLabel(amount: CommonBigDecimal(double: 84.12))
}
}

View File

@ -40,8 +40,7 @@ struct AccountTransactionListItem: View {
Spacer() Spacer()
VStack(alignment: .trailing) { VStack(alignment: .trailing) {
Text(presenter.formatAmount(amount: transaction.amount)) AmountLabel(amount: transaction.amount)
.styleAmount(amount: transaction.amount)
Spacer() Spacer()

View File

@ -69,8 +69,7 @@ struct AccountTransactionsDialog: View {
Spacer() Spacer()
Text(presenter.formatAmount(amount: balanceOfFilteredTransactions)) AmountLabel(amount: balanceOfFilteredTransactions)
.styleAmount(amount: balanceOfFilteredTransactions)
} }
.padding(.horizontal) .padding(.horizontal)

View File

@ -15,6 +15,8 @@ struct AllBanksListItem: View {
.font(.headline) .font(.headline)
Spacer() Spacer()
AmountLabel(amount: banks.sumBalances())
}.frame(height: 35) }.frame(height: 35)
NavigationLink(destination: LazyView(AccountTransactionsDialog(allBanks: self.banks))) { NavigationLink(destination: LazyView(AccountTransactionsDialog(allBanks: self.banks))) {

View File

@ -11,7 +11,10 @@ struct BankAccountListItem : View {
ZStack { ZStack {
HStack { HStack {
Text(account.displayName) Text(account.displayName)
Spacer() Spacer()
AmountLabel(amount: account.balance)
}.frame(height: 35) }.frame(height: 35)
NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account))) { NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account))) {

View File

@ -15,6 +15,8 @@ struct BankListItem : View {
.font(.headline) .font(.headline)
Spacer() Spacer()
AmountLabel(amount: bank.balance)
}.frame(height: 35) }.frame(height: 35)
NavigationLink(destination: LazyView(AccountTransactionsDialog(bank: self.bank))) { NavigationLink(destination: LazyView(AccountTransactionsDialog(bank: self.bank))) {