d

    dimsuz

    1 year ago
    I suspect this might be an FAQ, but didn't find right away (searched channel + googled)
    Column {
      Button(modifier = Modifier.fillMaxWidth()) {
        Icon()
        Spacer(weight = 1f)
        Text()
        Spacer(weight = 1f)
      }
    }
    This works great, but now I also have cases where I want to remove
    fillMaxWidth()
    and I want both spacers to be equal to
    0
    width when laid out. I.e. without
    fillMaxWidth
    I want this button to behave like "wrap_content" in old times: icon + text, centered in column, no space between them. Currently they still stretch, so removing
    fillMaxWidth
    has no effect and button stretches to full column width. Can this be done?
    Albert Chang

    Albert Chang

    1 year ago
    This can be achieved by a custom
    Arrangement
    . You can see
    Arrangement.SpaceEvenly
    and
    Arrangement.SpaceBetween
    for examples.
    d

    dimsuz

    1 year ago
    Great, thank you, I'll check them out!