Fixed making whole cell tapable

This commit is contained in:
dankito 2020-10-04 22:36:40 +02:00
parent 6f62690444
commit ebce0000c5
7 changed files with 11 additions and 4 deletions

View File

@ -60,6 +60,11 @@ extension View {
} }
func makeBackgroundTapable() -> some View {
return self.background(Color.systemBackground)
}
func detailForegroundColor() -> some View { func detailForegroundColor() -> some View {
return self return self
.foregroundColor(Color.secondary) .foregroundColor(Color.secondary)

View File

@ -44,7 +44,7 @@ struct SettingsDialog: View {
NavigationLink(destination: EmptyView(), isActive: .constant(false)) { // we need custom navigation handling, so disable that NavigationLink takes care of navigating NavigationLink(destination: EmptyView(), isActive: .constant(false)) { // we need custom navigation handling, so disable that NavigationLink takes care of navigating
Text("Secure app data") Text("Secure app data")
.frame(maxWidth: .infinity, alignment: .leading) // stretch over full width .frame(maxWidth: .infinity, alignment: .leading) // stretch over full width
.background(Color.systemBackground) // make background tapable .makeBackgroundTapable()
} }
} }
.onTapGesture { .onTapGesture {

View File

@ -55,6 +55,7 @@ struct AccountTransactionListItem: View {
Spacer() Spacer()
} }
} }
.makeBackgroundTapable()
.contextMenu { .contextMenu {
if transaction.canCreateMoneyTransferFrom { if transaction.canCreateMoneyTransferFrom {
Button(action: { self.navigateToTransferMoneyDialog(TransferMoneyData.Companion().fromAccountTransactionWithoutAmountAndReference(transaction: self.transaction)) }) { Button(action: { self.navigateToTransferMoneyDialog(TransferMoneyData.Companion().fromAccountTransactionWithoutAmountAndReference(transaction: self.transaction)) }) {

View File

@ -23,7 +23,7 @@ struct AllBanksListItem: View {
AmountLabel(banks.sumBalances()) AmountLabel(banks.sumBalances())
} }
.frame(height: 35) .frame(height: 35)
.background(Color.systemBackground) // make background tapable .makeBackgroundTapable()
} }
.onTapGesture { .onTapGesture {
SceneDelegate.navigateToView(AccountTransactionsDialog(allBanks: self.banks)) SceneDelegate.navigateToView(AccountTransactionsDialog(allBanks: self.banks))

View File

@ -13,7 +13,7 @@ struct BankAccountListItem : View {
NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account)), isActive: $navigateToAccountTransactionsDialog) { NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account)), isActive: $navigateToAccountTransactionsDialog) {
LabelledAmount(account.displayName, account.balance, account.currency) LabelledAmount(account.displayName, account.balance, account.currency)
.frame(height: 35) .frame(height: 35)
.background(Color.systemBackground) // make background tapable .makeBackgroundTapable()
} }
.disabled( !account.isAccountTypeSupportedByApplication) .disabled( !account.isAccountTypeSupportedByApplication)
.contextMenu { .contextMenu {

View File

@ -23,7 +23,7 @@ struct BankListItem : View {
AmountLabel(bank.balance) AmountLabel(bank.balance)
} }
.frame(height: 35) .frame(height: 35)
.background(Color.systemBackground) // make background tapable .makeBackgroundTapable()
.contextMenu { .contextMenu {
Button(action: { self.navigateToBankSettingsDialog() }) { Button(action: { self.navigateToBankSettingsDialog() }) {
HStack { HStack {

View File

@ -42,6 +42,7 @@ struct RecipientListItem: View {
.padding(.bottom, 6.0) .padding(.bottom, 6.0)
} }
.makeBackgroundTapable()
} }
} }