@@ -2,20 +2,24 @@ import SwiftUI
22
33struct POSOrderDetailsLoadingView : View {
44 var body : some View {
5- VStack ( spacing: 0 ) {
5+ VStack ( spacing: POSSpacing . none ) {
66 POSPageHeaderView (
7- title: Localization . orderDetailsTitle ,
7+ title: " " ,
88 backButtonConfiguration: nil ,
9+ leadingContent: { shimmeringHeaderLeadingContent } ,
910 trailingContent: { shimmeringHeaderTrailingContent } ,
1011 bottomContent: { shimmeringHeaderBottomContent }
1112 )
13+ . dynamicTypeSize ( ... DynamicTypeSize . xxxLarge)
1214
1315 ScrollView {
1416 VStack ( alignment: . leading, spacing: POSSpacing . medium) {
1517 shimmeringProductsSection
1618 shimmeringTotalsSection
1719 }
20+ . padding ( . top, POSPadding . xSmall)
1821 . padding ( . horizontal, POSPadding . medium)
22+ . padding ( . bottom, POSPadding . medium)
1923 }
2024 }
2125 . background ( Color . posSurface)
@@ -24,33 +28,49 @@ struct POSOrderDetailsLoadingView: View {
2428
2529 // MARK: - Shimmer Components
2630
31+ @ViewBuilder
32+ private var shimmeringHeaderLeadingContent : some View {
33+ HStack {
34+ Rectangle ( )
35+ . fill ( Color . posOnSurfaceVariantLowest)
36+ . frame ( width: Constants . longRowWidth, height: POSPadding . xxLarge)
37+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
38+ . shimmering ( )
39+ Spacer ( )
40+ }
41+ }
42+
2743 @ViewBuilder
2844 private var shimmeringHeaderTrailingContent : some View {
29- GeometryReader { geometry in
30- HStack {
31- Spacer ( )
32- Rectangle ( )
33- . fill ( Color . posOnSurfaceVariantLowest)
34- . frame ( width: geometry. size. width * 0.3 , height: 16 )
35- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
36- . shimmering ( )
37- }
45+ HStack {
46+ Spacer ( )
47+ Rectangle ( )
48+ . fill ( Color . posOnSurfaceVariantLowest)
49+ . frame ( width: Constants . shortRowWidth, height: POSPadding . large)
50+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
51+ . shimmering ( )
3852 }
39- . frame ( height: 16 )
4053 }
4154
4255 @ViewBuilder
4356 private var shimmeringHeaderBottomContent : some View {
44- GeometryReader { geometry in
45- VStack ( alignment: . leading, spacing: POSSpacing . xSmall) {
46- Rectangle ( )
47- . fill ( Color . posOnSurfaceVariantLowest)
48- . frame ( width: geometry. size. width * 0.5 , height: 16 )
49- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
50- . shimmering ( )
51- }
57+ VStack ( alignment: . leading, spacing: POSSpacing . xSmall) {
58+ Rectangle ( )
59+ . fill ( Color . posOnSurfaceVariantLowest)
60+ . frame ( width: Constants . longRowWidth, height: POSPadding . medium)
61+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
62+ . shimmering ( )
63+
64+ Spacer ( ) . frame ( height: POSSpacing . xSmall)
65+
66+ Rectangle ( )
67+ . fill ( Color . posOnSurfaceVariantLowest)
68+ . frame ( width: Constants . shortRowWidth, height: POSPadding . medium)
69+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
70+ . shimmering ( )
5271 }
53- . frame ( height: 16 )
72+ . padding ( . top, POSPadding . medium)
73+ . multilineTextAlignment ( . leading)
5474 }
5575
5676 @ViewBuilder
@@ -61,8 +81,12 @@ struct POSOrderDetailsLoadingView: View {
6181 . foregroundStyle ( Color . posOnSurface)
6282
6383 VStack ( spacing: POSSpacing . small) {
64- ForEach ( 0 ..< 2 , id: \. self) { _ in
84+ ForEach ( 0 ..< 2 , id: \. self) { index in
6585 shimmeringProductRow
86+
87+ if index < 1 {
88+ divider
89+ }
6690 }
6791 }
6892 }
@@ -73,39 +97,35 @@ struct POSOrderDetailsLoadingView: View {
7397
7498 @ViewBuilder
7599 private var shimmeringProductRow : some View {
76- GeometryReader { geometry in
77- HStack ( alignment: . top, spacing: POSSpacing . medium) {
100+ HStack ( alignment: . center, spacing: POSSpacing . medium) {
101+ Rectangle ( )
102+ . fill ( Color . posOnSurfaceVariantLowest)
103+ . frame ( width: POSPadding . xxLarge, height: POSPadding . xxLarge)
104+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
105+ . shimmering ( )
106+
107+ VStack ( alignment: . leading, spacing: POSSpacing . xSmall) {
78108 Rectangle ( )
79109 . fill ( Color . posOnSurfaceVariantLowest)
80- . frame ( width: 40 , height: 40 )
110+ . frame ( width: Constants . longRowWidth , height: POSPadding . medium )
81111 . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
82112 . shimmering ( )
83113
84- VStack ( alignment: . leading, spacing: POSSpacing . xSmall) {
85- Rectangle ( )
86- . fill ( Color . posOnSurfaceVariantLowest)
87- . frame ( width: geometry. size. width * 0.45 , height: 20 )
88- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
89- . shimmering ( )
90-
91- Rectangle ( )
92- . fill ( Color . posOnSurfaceVariantLowest)
93- . frame ( width: geometry. size. width * 0.35 , height: 16 )
94- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
95- . shimmering ( )
96- }
97-
98- Spacer ( )
99-
100114 Rectangle ( )
101115 . fill ( Color . posOnSurfaceVariantLowest)
102- . frame ( width: geometry . size . width * 0.2 , height: 20 )
103- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
116+ . frame ( width: Constants . shortRowWidth , height: POSPadding . medium )
117+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small . value ) )
104118 . shimmering ( )
105119 }
106- . padding ( . vertical, POSPadding . small)
120+
121+ Spacer ( )
122+
123+ Rectangle ( )
124+ . fill ( Color . posOnSurfaceVariantLowest)
125+ . frame ( width: Constants . shortRowWidth, height: POSPadding . medium)
126+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
127+ . shimmering ( )
107128 }
108- . frame ( height: 60 )
109129 }
110130
111131 @ViewBuilder
@@ -120,10 +140,10 @@ struct POSOrderDetailsLoadingView: View {
120140 shimmeringTotalsRow
121141 shimmeringTotalsRow
122142
123- Divider ( )
124- . background ( Color . posSurfaceDim)
125-
143+ divider
126144 shimmeringTotalsRow
145+
146+ divider
127147 shimmeringTotalsRow
128148 }
129149 }
@@ -134,34 +154,38 @@ struct POSOrderDetailsLoadingView: View {
134154
135155 @ViewBuilder
136156 private var shimmeringTotalsRow : some View {
137- GeometryReader { geometry in
138- HStack {
139- Rectangle ( )
140- . fill ( Color . posOnSurfaceVariantLowest)
141- . frame ( width: geometry. size. width * 0.3 , height: 20 )
142- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
143- . shimmering ( )
144-
145- Spacer ( )
146-
147- Rectangle ( )
148- . fill ( Color . posOnSurfaceVariantLowest)
149- . frame ( width: geometry. size. width * 0.25 , height: 20 )
150- . clipShape ( RoundedRectangle ( cornerRadius: 4 ) )
151- . shimmering ( )
152- }
157+ HStack {
158+ Rectangle ( )
159+ . fill ( Color . posOnSurfaceVariantLowest)
160+ . frame ( width: Constants . mediumRowWidth, height: POSPadding . large)
161+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
162+ . shimmering ( )
163+
164+ Spacer ( )
165+
166+ Rectangle ( )
167+ . fill ( Color . posOnSurfaceVariantLowest)
168+ . frame ( width: Constants . shortRowWidth, height: POSPadding . large)
169+ . clipShape ( RoundedRectangle ( cornerRadius: POSCornerRadiusStyle . small. value) )
170+ . shimmering ( )
153171 }
154- . frame ( height: 20 )
172+ }
173+
174+ @ViewBuilder
175+ private var divider : some View {
176+ Divider ( )
177+ . overlay ( Color . posOutlineVariant. opacity ( 0.5 ) )
178+ . padding ( . vertical, POSSpacing . small)
155179 }
156180}
157181
158- private enum Localization {
159- static let orderDetailsTitle = NSLocalizedString (
160- " pos.orderDetailsLoadingView.title " ,
161- value: " Order " ,
162- comment: " Title for the order details screen when no specific order is selected "
163- )
182+ private enum Constants {
183+ static let longRowWidth : CGFloat = 120
184+ static let mediumRowWidth : CGFloat = 100
185+ static let shortRowWidth : CGFloat = 80
186+ }
164187
188+ private enum Localization {
165189 static let productsTitle = NSLocalizedString (
166190 " pos.orderDetailsLoadingView.productsTitle " ,
167191 value: " Products " ,
0 commit comments