ButtonGroupScope


Button group scope used to indicate a Modifier.weight of a child element.

Summary

Public functions

Modifier

Specifies the interaction source to use with this item.

Cmn
Modifier
Modifier.weight(
    weight: @FloatRange(from = 0.0, fromInclusive = false) Float,
    fill: Boolean
)

Size the element's width proportional to its weight relative to other weighted sibling elements in the ButtonGroup.

Cmn

Public functions

animateWidth

fun Modifier.animateWidth(interactionSource: InteractionSource): Modifier

Specifies the interaction source to use with this item. This is used to listen to events and animate growing the pressed button and shrink the neighbor(s).

Parameters
interactionSource: InteractionSource

the InteractionSource that button group will observe.

fun Modifier.weight(
    weight: @FloatRange(from = 0.0, fromInclusive = false) Float,
    fill: Boolean = true
): Modifier

Size the element's width proportional to its weight relative to other weighted sibling elements in the ButtonGroup. The parent will divide the horizontal space remaining after measuring unweighted child elements and distribute it according to this weight. When fill is true, the element will be forced to occupy the whole width allocated to it. Otherwise, the element is allowed to be smaller - this will result in ButtonGroup being smaller, as the unused allocated width will not be redistributed to other siblings.

Parameters
weight: @FloatRange(from = 0.0, fromInclusive = false) Float

The proportional width to give to this element, as related to the total of all weighted siblings. Must be positive.

fill: Boolean = true

When true, the element will occupy the whole width allocated.