https://kotlinlang.org logo
#compose
Title
# compose
a

Adriano Celentano

09/20/2020, 12:44 PM
Just went through all the
LayoutModifier
implementations just
PainterModifier
i didnt understand what its good for ?
SizeModifier define exact constraints maxWidth / minWidth + maxHeight / minHeight FillModifier match parent. have the content fill (possibly only partially) the Constraints.maxWidth / maxHeight of the incoming measurement constraints AlignmentModifier wrap content. use the size of the content, but at least fill the mininum constraints size UnspecifiedConstraintsModifier define default minimum constraints in case there are no incoming constraints provided AspectRatioModifier size the content to match a specified aspect ratio according to an incoming constraint PaddingModifier adds padding to the Element OffsetModifier / OffsetPxModifier offsets the Element by x, y PainterModifier ??
z

Zach Klippenstein (he/him) [MOD]

09/20/2020, 4:41 PM
I believe it uses a Painter to draw a background behind the composable.
n

Nader Jawad

09/20/2020, 6:49 PM
Painter is similar to the framework's Drawables API. It's an abstraction for a resource that can handle drawing content. The Image composable uses a Painter behind the scenes to draw either vector graphics or ImageAssets (bitmaps). Painters have a concept of an intrinsic size that is useful not just for sizing information but for determining how to draw contents in an area that is larger or smaller than its size. Because of this a PainterModifier is both a LayoutModifier and a DrawModifier
😮 2
For example, an Image composable that does not have any sizing modifiers applied to it will size its contents automatically to the intrinsic size of the underlying PainterModifier. The placement of the drawing content within the specified layout bounds is dictated by both the ContentScale and Alignment parameters as well
a

Adriano Celentano

09/20/2020, 7:09 PM
thank you 🙏
👍 1