Flexbox | CSS Flexible Box Layout Module for Kodular

Image by Dev.to

Flexbox

Flexbox is a layout extension which brings the similar capabilities of CSS Flexible Box Layout Module to Android. I am super excited to share it with you.


Note : All the possible values for a block are shown with that block in the image.

Docs


create

Create flexbox in a layout


add view

Add a new component to the flexbox


Flex Container Properties


flex direction

This attribute determines the direction of the main axis (and the cross axis, perpendicular to the main axis). The direction children items are placed inside the Flexbox layout.


flex wrap

This attribute controls whether the flex container is single-line or multi-line, and the direction of the cross axis.


justify content

This attribute controls the alignment along the main axis.


align items

This attribute controls the alignment along the cross axis.


align content

This attribute controls the alignment of the flex lines in the flex container.


horizontal divide

Puts horizontal dividers between flex lines. Use asset images


vertical divider

Puts vertical dividers between flex lines


show horizontal divider

Specify the location where divider should be shown


show vertical divider

Specify the location where divider should be shown


Flex Item Properties


order

This attribute can change how the ordering of the children views are laid out. By default, children are displayed and laid out in the same order as they are added. If not specified, 1 is set as a default value.


flex grow

This attribute determines how much this child will grow if positive free space is distributed relative to the rest of other flex items included in the same flex line. If a flex item has a positive lflexGrow value, the item will take up the remaining space in the flex line. If multiple flex items in the same flex line have positive flexGrow values, the remaining free space is distributed depending on the proportion of their declared flexGrow value.

In simple words, the component will try to cover the free space that is left in the current flex line.


flex shrink

This attribute determines how much this child will shrink if negative free space is distributed relative to the rest of other flex items included in the same flex line. If not specified, 1 is set as a default value.

In simple words, the component will try to shrink to give space to other flex items


align self

This attribute determines the alignment along the cross axis (perpendicular to the main axis). The alignment in the same direction can be determined by the alignItems in the parent, but if this is set to other than auto , the cross axis alignment is overridden for this child.


basis percent

The initial flex item length in a fraction format relative to its parent. The initial main size of this child view is trying to be expanded as the specified fraction against the parent main size. If this value is set, the length specified from width (or height ) is overridden by the calculated value from this attribute.


min width

This attribute imposes minimum width for the flex item. A child view won’t shrink less than the value of these attributes


max width

This attribute imposes maximum width for the flex item. A child view won’t be expanded more than the value of these attributes


min height

This attribute imposes minimum height for the flex item. A child view won’t shrink less than the value of these attributes


max height

This attribute imposes maximum height for the flex item. A child view won’t be expanded more than the value of these attributes


wrap before

This attribute forces a flex line wrapping, the default value is false . i.e. if this is set to true for a flex item, the item will become the first item of a flex line. (A wrapping happens regardless of the flex items being processed in the previous flex line) This attribute is ignored if the flex_wrap attribute is set to nowrap .


Ahhhhhhhhh Finally. I hate writing docs :expressionless: :expressionless:


Downloads

Aix File : com.dreamers.flexbox.aix (52.8 KB)
Aia File : FlexBox.aia (55.5 KB)


I am sorry if I could not explain well. This is because Flexbox itself is very complicated if you see for the first time. However if you have used flexbox in css, then you wont get confused.

Special thanks to @KodularCreator for this platform and @Shreyash for super awesome Rush ( Specially for Kotlin )

24 Likes

@zainulhassan
Another great Extension, congratulations!:clap:
Great Job ! :clap::clap::clap::clap::clap::clap:
Works like Bootstrap :+1:

2 Likes

Yeah it brings css flex properties to android. I was very excited when I first saw this.

3 Likes

This is Super Amazing:star_struck::star_struck:

@zainulhassan its really amazing :heart_eyes:

Wow. Cool, & helpful extension. I can’t find out where should i use that. Thinking :thinking:

1 Like