Compose Modifier

widthIn

Constrain the width of the content to be between mindp and maxdp as permitted by the incoming measurement Constraints.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

widthIn

Common
fun Modifier.widthIn(min: Dp = Dp.Unspecified, max: Dp = Dp.Unspecified) =
    this.then(
        SizeElement(
            minWidth = min,
            maxWidth = max,
            enforceIncoming = true,
            inspectorInfo =
                debugInspectorInfo {
                    name = "widthIn"
                    properties["min"] = min
                    properties["max"] = max
                },
        )
    )

Constrain the width of the content to be between mindp and maxdp as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.