mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
multi selection should have the accessory on the leading side
This commit is contained in:
@@ -218,12 +218,22 @@ private struct RowContent<Label: View, DetailsIcon: View>: View {
|
||||
let label: () -> Label
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: ListRowTrailingSectionSpacing.horizontal) {
|
||||
label()
|
||||
.frame(maxWidth: .infinity)
|
||||
HStack(spacing: 0) {
|
||||
// We should always have multi selection shown on the leading side
|
||||
if let accessory, accessory.kind.isMultiSelection {
|
||||
accessory
|
||||
.padding(.leading, ListRowPadding.horizontal)
|
||||
}
|
||||
|
||||
if details != nil || accessory != nil {
|
||||
ListRowTrailingSection(details, accessory: accessory)
|
||||
HStack(spacing: ListRowTrailingSectionSpacing.horizontal) {
|
||||
label()
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
if details != nil || accessory != nil {
|
||||
ListRowTrailingSection(details,
|
||||
// Prevent multi selection to appear on the trailing side
|
||||
accessory: accessory?.kind.isMultiSelection == true ? nil : accessory)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
|
||||
@@ -23,6 +23,15 @@ public struct ListRowAccessory: View {
|
||||
case multiSelected
|
||||
/// An empty circle.
|
||||
case multiUnselected
|
||||
|
||||
var isMultiSelection: Bool {
|
||||
switch self {
|
||||
case .multiSelected, .multiUnselected:
|
||||
true
|
||||
default:
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A chevron to indicate that the button pushes another screen.
|
||||
|
||||
Reference in New Issue
Block a user