@@ -23,6 +23,7 @@ import androidx.compose.ui.Modifier
23
23
import androidx.compose.ui.draw.clip
24
24
import androidx.compose.ui.graphics.Color
25
25
import androidx.compose.ui.graphics.vector.ImageVector
26
+ import androidx.compose.ui.layout.ContentScale
26
27
import androidx.compose.ui.res.stringResource
27
28
import androidx.compose.ui.res.vectorResource
28
29
import androidx.compose.ui.text.font.FontWeight
@@ -74,6 +75,7 @@ fun RestaurantTitle(
74
75
) {
75
76
Row (
76
77
modifier = modifier,
78
+ verticalAlignment = Alignment .CenterVertically ,
77
79
) {
78
80
Text (
79
81
modifier = Modifier .padding(top = 6 .dp),
@@ -104,7 +106,9 @@ fun RestaurantLoveCount(
104
106
onLoveClick : () -> Unit ,
105
107
) {
106
108
Column (
107
- modifier = Modifier .clickable(
109
+ modifier = Modifier
110
+ .padding(top = 6 .dp)
111
+ .clickable(
108
112
indication = null ,
109
113
interactionSource = remember { MutableInteractionSource () }
110
114
) { onLoveClick() },
@@ -157,23 +161,33 @@ fun RestaurantRating(restaurant: RestaurantDataEntity) {
157
161
fun RestaurantImage (restaurant : RestaurantDataEntity ) {
158
162
Row (
159
163
modifier = Modifier .fillMaxWidth(),
160
- horizontalArrangement = Arrangement .SpaceBetween
164
+ horizontalArrangement = Arrangement .spacedBy( 6 .dp)
161
165
) {
166
+ // restaurant.images?.take(3)?.forEachIndexed { index, image ->
167
+ // AsyncImage(
168
+ // model = image,
169
+ // contentDescription = null,
170
+ // modifier = Modifier
171
+ // .weight(1f)
172
+ // .aspectRatio(1f)
173
+ // .padding(end = if (index < 2) 6.dp else 0.dp)
174
+ // .clip(RoundedCornerShape(8.dp)),
175
+ // contentScale = ContentScale.Crop
176
+ // )
177
+ // }
162
178
restaurant.images?.let {
163
179
when {
164
- restaurant.images?.size = = 3 -> {
165
- restaurant.images?.forEachIndexed { index, image ->
180
+ restaurant.images?.size!! > = 3 -> {
181
+ restaurant.images?.take( 3 )?. forEachIndexed { index, image ->
166
182
AsyncImage (
183
+ model = image,
184
+ contentDescription = null ,
167
185
modifier = Modifier
168
186
.weight(1f )
169
187
.aspectRatio(1f )
170
188
.clip(RoundedCornerShape (8 .dp)),
171
- model = image,
172
- contentDescription = null
189
+ contentScale = ContentScale .Crop
173
190
)
174
- if (index != 2 ) {
175
- Spacer (modifier = Modifier .padding(end = 6 .dp))
176
- }
177
191
}
178
192
}
179
193
@@ -185,11 +199,12 @@ fun RestaurantImage(restaurant: RestaurantDataEntity) {
185
199
.aspectRatio(1f )
186
200
.clip(RoundedCornerShape (8 .dp)),
187
201
model = image,
188
- contentDescription = null
202
+ contentDescription = null ,
203
+ contentScale = ContentScale .Crop
189
204
)
190
- if (index != 1 ) {
191
- Spacer (modifier = Modifier .padding(end = 6 .dp))
192
- }
205
+ // if(index != 1) {
206
+ // Spacer(modifier = Modifier.padding(end = 6.dp))
207
+ // }
193
208
}
194
209
Spacer (modifier = Modifier .weight(1f ))
195
210
}
@@ -205,56 +220,56 @@ fun RestaurantImage(restaurant: RestaurantDataEntity) {
205
220
)
206
221
Spacer (modifier = Modifier
207
222
.weight(2f )
208
- .padding(end = 6 .dp)
223
+ // .padding(end = 6.dp)
209
224
)
210
225
}
211
226
212
- restaurant.images?.size!! > 3 -> {
213
- AsyncImage (
214
- modifier = Modifier
215
- .weight(1f )
216
- .aspectRatio(1f )
217
- .clip(RoundedCornerShape (8 .dp)),
218
- model = restaurant.images!! [0 ],
219
- contentDescription = null
220
- )
221
- Spacer (modifier = Modifier .padding(end = 6 .dp))
222
- AsyncImage (
223
- modifier = Modifier
224
- .weight(1f )
225
- .aspectRatio(1f )
226
- .clip(RoundedCornerShape (8 .dp)),
227
- model = restaurant.images!! [0 ],
228
- contentDescription = null
229
- )
230
- Spacer (modifier = Modifier .padding(end = 6 .dp))
231
- Box (
232
- modifier = Modifier
233
- .weight(1f )
234
- .aspectRatio(1f )
235
- ) {
236
- AsyncImage (
237
- modifier = Modifier
238
- .aspectRatio(1f )
239
- .fillMaxSize(),
240
- model = restaurant.images!! [0 ],
241
- contentDescription = null
242
- )
243
- Box (
244
- modifier = Modifier
245
- .matchParentSize()
246
- .clip(RoundedCornerShape (8 .dp))
247
- .background(Color .Black .copy(alpha = 0.2f )),
248
- contentAlignment = Alignment .Center
249
- ) {
250
- Text (
251
- text = " +${restaurant.reviewCount - 2 } " ,
252
- color = Color .White ,
253
- fontSize = 14 .sp
254
- )
255
- }
256
- }
257
- }
227
+ // restaurant.images?.size!! > 3 -> {
228
+ // AsyncImage(
229
+ // modifier = Modifier
230
+ // .weight(1f)
231
+ // .aspectRatio(1f)
232
+ // .clip(RoundedCornerShape(8.dp)),
233
+ // model = restaurant.images!![0],
234
+ // contentDescription = null
235
+ // )
236
+ // Spacer(modifier = Modifier.padding(end = 6.dp))
237
+ // AsyncImage(
238
+ // modifier = Modifier
239
+ // .weight(1f)
240
+ // .aspectRatio(1f)
241
+ // .clip(RoundedCornerShape(8.dp)),
242
+ // model = restaurant.images!![0],
243
+ // contentDescription = null
244
+ // )
245
+ // Spacer(modifier = Modifier.padding(end = 6.dp))
246
+ // Box(
247
+ // modifier = Modifier
248
+ // .weight(1f)
249
+ // .aspectRatio(1f)
250
+ // ) {
251
+ // AsyncImage(
252
+ // modifier = Modifier
253
+ // .aspectRatio(1f)
254
+ // .fillMaxSize(),
255
+ // model = restaurant.images!![0],
256
+ // contentDescription = null
257
+ // )
258
+ // Box(
259
+ // modifier = Modifier
260
+ // .matchParentSize()
261
+ // .clip(RoundedCornerShape(8.dp))
262
+ // .background(Color.Black.copy(alpha = 0.2f)),
263
+ // contentAlignment = Alignment.Center
264
+ // ) {
265
+ // Text(
266
+ // text = "+${restaurant.reviewCount - 2}",
267
+ // color = Color.White,
268
+ // fontSize = 14.sp
269
+ // )
270
+ // }
271
+ // }
272
+ // }
258
273
}
259
274
}
260
275
}
0 commit comments