dave08
11/09/2022, 4:24 PMdave08
11/09/2022, 4:25 PMRow(
        modifier = Modifier
            .padding(10.dp)
            .fillMaxWidth(),
    ) {
        Row {
            AsyncImage(
                model = item.imageUrl,
                contentDescription = null,
                modifier = Modifier.size(40.dp)
            )
            Column(
                modifier = Modifier.padding(start = 15.dp, end = 15.dp)
            ) {
                Text(
                    text = item.name,
                    maxLines = 1,
                    overflow = TextOverflow.Ellipsis,
//                    fontSize = 15.sp,
                    style = MaterialTheme.typography.bodyMedium
                )
                Text(
                    text = "When last updated",
                    style = MaterialTheme.typography.labelMedium,
                    color = MaterialTheme.colorScheme.tertiary
                )
            }
        }
        Spacer(Modifier.weight(1f))
        AppActionButton(onClick = { /*TODO*/ }) {
            Text(stringResource(id = buttonTextId), softWrap = false)
        }
    }dave08
11/09/2022, 4:27 PMrobercoding
11/09/2022, 4:43 PMSpacer and then in the 2nd row (empty one) set this:
Row(modifier = Modifier.weight(1f)){dave08
11/09/2022, 5:02 PMweight really means.robercoding
11/09/2022, 5:09 PMweight and it says that it measures the unweighted children and then for the weight ones it *distributes accordingly (To the available space and other weight siblings).*
What I get is that Row wasn't distributed accordingly previously and was just pushing as much as it wanted. If you added .weight(1f) to it, then it was being distributed along side the Spacer and it was respecting the Button. So if you remove the Spacer now it's only the sibling Row filling the entire parent Row and respecting the Button.
Also notice that weight(1f) has a fill = true by default, if you set it to false the Button won't be at the end, but next to the Row sibling
TLDR: Unweighted ones have priority over weight ones! You can tell weight ones to fill the remaining available space or notdave08
11/10/2022, 10:32 AM