Extracted removeListInsets() and removeSectionBackground()

This commit is contained in:
dankito 2020-09-23 22:42:14 +02:00
parent 5ded582c78
commit ba260b4826
8 changed files with 18 additions and 10 deletions

View File

@ -78,6 +78,17 @@ extension View {
return self.background(Color.systemGroupedBackground)
}
func removeListInsets() -> some View {
return self.listRowInsets(EdgeInsets())
}
func removeSectionBackground() -> some View {
return self
.systemGroupedBackground()
.removeListInsets()
}
func styleAmount(amount: CommonBigDecimal) -> some View {
let amountColor = amount.decimal.isPositive() ? Styles.PositiveAmountColor : Styles.NegativeAmountColor

View File

@ -48,7 +48,7 @@ struct LabelledUIKitTextFieldWithValidationLabel: View {
ValidationLabel(validationResult)
}
}
.listRowInsets(EdgeInsets())
.removeListInsets()
}

View File

@ -102,8 +102,7 @@ struct AccountTransactionsDialog: View {
.padding(.horizontal, 6)
}
.frame(maxWidth: .infinity, minHeight: 44) // has to have at least a height of 44 (iOS 14; iOS 13: 40), otherwise a white line at bottom gets displayed
.systemGroupedBackground() // TODO: extract with below .removeSectionBackground() (or create View?)
.listRowInsets(EdgeInsets()) // TODO: extract remove list insets
.removeListInsets()
}
if showTransactionsList {

View File

@ -29,8 +29,7 @@ struct AccountsDialog: View {
Section {
AddAccountButtonView()
}
.systemGroupedBackground()
.listRowInsets(EdgeInsets())
.removeSectionBackground()
}
}

View File

@ -12,7 +12,7 @@ struct Divider: View {
Rectangle()
.fill(color)
.frame(height: height)
.listRowInsets(EdgeInsets())
.removeListInsets()
.edgesIgnoringSafeArea(.horizontal)
.padding(0)
}

View File

@ -31,8 +31,7 @@ struct InfoLabel: View {
.frame(height: 18)
}
.font(.callout)
.systemGroupedBackground()
.listRowInsets(EdgeInsets())
.removeSectionBackground()
}
}

View File

@ -44,7 +44,7 @@ struct SearchBarWithLabel<Label: View>: View {
.padding(.horizontal)
.padding(.bottom, 8)
}
.listRowInsets(EdgeInsets())
.removeListInsets()
}
}

View File

@ -145,7 +145,7 @@ struct FlickerCodeTanView: View {
.padding(.bottom, 12)
}
.background(Color.black)
.listRowInsets(EdgeInsets())
.removeListInsets()
}
// what a hack to be able to call animator.animate() (otherwise compiler would throw 'use of immutable self in closure' error)
.executeMutatingMethod {