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.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:56eeb69cb930a4a8768b9e965cb1b107d9e2d6e767284b20c720cbd026318977
|
||||
size 397819
|
||||
oid sha256:82772eb033bbbcd890f2fc4029430ba9436d9643535a73c4f368151149537edc
|
||||
size 398298
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b92722ff5a722dcf2f3815311d99149bf70ed8c146350a5ff83caab4ed63cb93
|
||||
size 266194
|
||||
oid sha256:de442478c2e805ffda381d0e309e16558dee99d6834fa76bd454138db0c1fb7a
|
||||
size 265583
|
||||
|
||||
Reference in New Issue
Block a user