Код: Выделить всё
FlowRow(
horizontalArrangement = Arrangement.spacedBy(
2.dp,
Alignment.CenterHorizontally
),
verticalArrangement = Arrangement.spacedBy(
2.dp,
Alignment.CenterVertically
),
maxItemsInEachRow = 3,
overflow = FlowRowOverflow.Visible,
) {
Chip(
text = "enter the room",
icon = R.drawable.ic_wallet,
onClick = { },
modifier = Modifier.weight(1f)
)
}
Код: Выделить всё
@Composable
private fun Chip(
text: String,
@DrawableRes icon: Int,
onClick: () -> Unit,
modifier: Modifier = Modifier,
hasBalloon: Boolean = false,
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = modifier
.background(
shape = RoundedCornerShape(CornerSize(8.dp)),
color = Color.Grey
)
.rippleClickable(onClick = onClick)
.padding(4.dp)
) {
Text(
text,
maxLines = 1,
textAlign = TextAlign.Center,
overflow = TextOverflow.Ellipsis,
)
Box(
modifier = Modifier
.padding(start = 4.dp)
.size(16.dp)
) {
GlideImage(
model = icon,
transition = CrossFade,
contentDescription = "",
contentScale = ContentScale.Fit,,
)
if (hasBalloon) {
Box(
modifier = Modifier
.width(7.dp)
.height(7.dp)
.background(shape = CircleShape, color = Colors.Red)
.align(Alignment.TopEnd)
)
}
}
}
Изменение Box size (16.dp) с
size (16.dp) с
code> 's размер (16.dp)
Код: Выделить всё
.fillMaxHeight()
.aspectRatio(1f)
Подробнее здесь: https://stackoverflow.com/questions/795 ... -correctly