TheMrCodes
02/22/2021, 7:08 PMVitor Prado
02/22/2021, 7:14 PMBoxWithConstraints
Vitor Prado
02/22/2021, 7:15 PM/**
* The constraints given by the parent layout in pixels.
*
* Use [minWidth], [maxWidth], [minHeight] or [maxHeight] if you need value in [Dp].
*/
val constraints: Constraints
/**
* The minimum width in [Dp].
*
* @see constraints for the values in pixels.
*/
val minWidth: Dp
/**
* The maximum width in [Dp].
*
* @see constraints for the values in pixels.
*/
val maxWidth: Dp
/**
* The minimum height in [Dp].
*
* @see constraints for the values in pixels.
*/
val minHeight: Dp
/**
* The minimum height in [Dp].
*
* @see constraints for the values in pixels.
*/
val maxHeight: Dp
TheMrCodes
02/22/2021, 8:25 PMTash
02/22/2021, 10:01 PMwidth
/ height
you can intercept with Modifier.layout
Modifier.layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
val width = placeable.width
val height = placeable.height
...
}
Nader Jawad
02/23/2021, 12:04 AMModifier.drawWithCache
to give an opportunity to allocate graphics objects when sizing information is known and re-use those objects within the corresponding onDraw
block wihin the implementation. This is useful to create gradients with sizing information known upfront or Paths and re-use he result across draw calls as long as the size has not changed or state parameters being read do not change.