'How does the chain of wrapContentSize, width and fillMaxSize modifiers work together in Compose

The Jetpack Compose Animation Codelab contains a custom TabRow's indicator HomeTabIndicator. It takes the TabPosition coordinates and renders a Box using the following chain of modifiers:

    val indicatorLeft = tabPositions[tabPage.ordinal].left
    val indicatorRight = tabPositions[tabPage.ordinal].right
    Box(
        Modifier
            .fillMaxSize()
            .wrapContentSize(align = Alignment.BottomStart)
            .offset(x = indicatorLeft)
            .width(indicatorRight - indicatorLeft)
            .padding(4.dp)
            .fillMaxSize()
            .border(
                ...border params
            )
    )

How do the modifiers in the chain fillMaxSize > wrapContentSize > offset > width > fillMaxSize play together?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source