marcglasberg / align_positioned

Flutter Package: When your desired layout or animation is too complex for Columns and Rows, this widget lets you position/size/rotate/transform its child in complex ways.
BSD 2-Clause "Simplified" License
75 stars 8 forks source link

childHeightRatio as a proportion to parent's Width #3

Closed Magenda closed 3 years ago

Magenda commented 4 years ago

Is there any way to set child's height as a proportion to parent's width? This is a very common need and it would be very nice if it would be supported internally from the plugin (without writing a setState manually). Example use case: size a container with the same width and heigh that equals to 1/5 of parent's width.

Kudos for your excellent work with all your published plugins!

marcglasberg commented 4 years ago

Thanks.

I never thought defining width in respect to height (or vice-versa) would be useful. Is it really a common need? In any case, do you have an API suggestion for that?

marcglasberg commented 3 years ago

This is now working. See version [1.2.12]

Parameters moveByChildWidth and moveByChildHeight can be positive or negative, and move the child horizontally and vertically, but the unit here is not pixels, but child widths and heights.

Parameters moveByContainerWidth and moveByContainerHeight can be positive or negative, and move the child horizontally and vertically, but the unit here is not pixels, but container widths and heights.

Parameters moveVerticallyByChildWidth, moveHorizontallyByChildHeight, moveVerticallyByContainerWidth and moveHorizontallyByContainerHeight allow you to move in some direction according to the size (width or height) of the orthogonal direction. For example, while moveByChildWidth: 0.2 would move horizontally by 20% of the child's width, moveVerticallyByChildWidth would move vertically by 20% of the child's width.