@@ -8,12 +8,14 @@ import androidx.compose.foundation.layout.BoxScope
8
8
import androidx.compose.foundation.layout.Column
9
9
import androidx.compose.foundation.layout.ColumnScope
10
10
import androidx.compose.foundation.layout.Row
11
+ import androidx.compose.foundation.layout.Spacer
11
12
import androidx.compose.foundation.layout.fillMaxSize
12
13
import androidx.compose.foundation.layout.fillMaxWidth
13
14
import androidx.compose.foundation.layout.height
14
15
import androidx.compose.foundation.layout.heightIn
15
16
import androidx.compose.foundation.layout.padding
16
17
import androidx.compose.foundation.layout.size
18
+ import androidx.compose.foundation.layout.wrapContentHeight
17
19
import androidx.compose.foundation.shape.CircleShape
18
20
import androidx.compose.material.icons.Icons
19
21
import androidx.compose.material.icons.automirrored.filled.ArrowBack
@@ -38,6 +40,8 @@ import androidx.compose.ui.geometry.Offset
38
40
import androidx.compose.ui.graphics.Color
39
41
import androidx.compose.ui.platform.LocalContext
40
42
import androidx.compose.ui.res.painterResource
43
+ import androidx.compose.ui.text.font.FontWeight
44
+ import androidx.compose.ui.text.style.TextOverflow
41
45
import androidx.compose.ui.unit.dp
42
46
import androidx.hilt.navigation.compose.hiltViewModel
43
47
import com.canopas.yourspace.R
@@ -139,43 +143,83 @@ private fun JourneyInfo(journey: LocationJourney) {
139
143
val distance = getDistanceString(journey.route_distance ? : 0.0 )
140
144
val duration = getRouteDurationString(journey.route_duration ? : 0 )
141
145
142
- Text (
143
- text = " $distance - $duration " ,
144
- color = AppTheme .colorScheme.textPrimary,
145
- style = AppTheme .appTypography.header2,
146
- modifier = Modifier
147
- .padding(top = 8 .dp, bottom = 24 .dp)
148
- .padding(horizontal = 16 .dp)
149
- )
146
+ if (toAddress != null ) {
147
+ Text (
148
+ text = " $distance - $duration " ,
149
+ color = AppTheme .colorScheme.textPrimary,
150
+ style = AppTheme .appTypography.header2,
151
+ modifier = Modifier
152
+ .padding(top = 8 .dp, bottom = 24 .dp)
153
+ .padding(horizontal = 16 .dp)
154
+ )
150
155
151
- Row (
152
- verticalAlignment = Alignment .Top ,
153
- modifier = Modifier
154
- .height(90 .dp)
155
- ) {
156
- DottedTimeline (isSteadyLocation = false , isLastItem = false , isJourneyDetail = true )
157
- Column (
156
+ Row (
157
+ verticalAlignment = Alignment .Top ,
158
158
modifier = Modifier
159
- .padding(start = 16 .dp)
160
- .weight(1f )
159
+ .height(90 .dp)
161
160
) {
162
- PlaceInfo (fromAddressStr, getFormattedLocationTime(journey.created_at!! ))
161
+ DottedTimeline (isSteadyLocation = false , isLastItem = false , isJourneyDetail = true )
162
+ Column (
163
+ modifier = Modifier
164
+ .padding(start = 16 .dp)
165
+ .weight(1f )
166
+ ) {
167
+ PlaceInfo (fromAddressStr, getFormattedLocationTime(journey.created_at!! ))
168
+ }
163
169
}
164
- }
165
170
166
- Row (
167
- verticalAlignment = Alignment .Top ,
168
- modifier = Modifier
169
- .height(90 .dp)
170
- ) {
171
- DottedTimeline (isSteadyLocation = true , isLastItem = true , isJourneyDetail = true )
172
- Column (
171
+ Row (
172
+ verticalAlignment = Alignment .Top ,
173
173
modifier = Modifier
174
- .padding(start = 16 .dp)
175
- .weight(1f )
174
+ .height(90 .dp)
176
175
) {
177
- journey.update_at?.let { getFormattedLocationTime(it) }
178
- ?.let { PlaceInfo (toAddressStr, it) }
176
+ DottedTimeline (isSteadyLocation = true , isLastItem = true , isJourneyDetail = true )
177
+ Column (
178
+ modifier = Modifier
179
+ .padding(start = 16 .dp)
180
+ .weight(1f )
181
+ ) {
182
+ journey.update_at?.let { getFormattedLocationTime(it) }
183
+ ?.let { PlaceInfo (toAddressStr, it) }
184
+ }
185
+ }
186
+ } else {
187
+ Row (
188
+ verticalAlignment = Alignment .Top ,
189
+ modifier = Modifier .wrapContentHeight().padding(4 .dp)
190
+ ) {
191
+ Icon (
192
+ painter = painterResource(R .drawable.ic_journey_destination),
193
+ contentDescription = " " ,
194
+ tint = AppTheme .colorScheme.primary,
195
+ modifier = Modifier
196
+ .padding(start = 8 .dp)
197
+ .background(AppTheme .colorScheme.secondaryInverseVariant, CircleShape )
198
+ .size(30 .dp)
199
+ .padding(4 .dp)
200
+ )
201
+ Column (
202
+ modifier = Modifier
203
+ .padding(start = 16 .dp)
204
+ .weight(1f )
205
+ ) {
206
+ Text (
207
+ text = fromAddressStr,
208
+ style = AppTheme .appTypography.body2.copy(
209
+ color = AppTheme .colorScheme.textPrimary,
210
+ fontWeight = FontWeight .Medium
211
+ ),
212
+ overflow = TextOverflow .Ellipsis ,
213
+ modifier = Modifier .padding(end = 16 .dp)
214
+ )
215
+
216
+ Spacer (modifier = Modifier .size(8 .dp))
217
+
218
+ Text (
219
+ text = getFormattedLocationTime(journey.created_at!! ),
220
+ style = AppTheme .appTypography.caption.copy(color = AppTheme .colorScheme.textDisabled)
221
+ )
222
+ }
179
223
}
180
224
}
181
225
}
0 commit comments