Links

Column

The Column widget is used to create a vertical layout. It is one of the most used widgets.
Here’s how the column arranges its children:
Column widget
The figure above shows that the Main Axis and the Cross Axis are two important column properties. For a column, the Main Axis runs vertically, and the Cross Axis runs horizontally. By default, all the children inside the column will be arranged in a vertical fashion.

Add Column widget

To add a column widget in your project:
  1. 1.
    Drag the column widget from the Layout Elements tab (in the Widget Panel) or add it directly from the widget tree.
  2. 2.
    Next, add a few Image widgets from the Base Element section.

Customizing

The Properties Panel can be used to customize the behavior of your column widget.

Add Padding

Here are the instructions on how to add padding.

Adjust Alignment

Here are the instructions for adjusting the alignment.

Changing Main Axis Size

The Main Axis Size defines how much space a Column should occupy in the main axis (i.e., vertical direction).
You can set the main axis size using the following two options:
  • Minimum(
    ): Make the column occupy the minimum amount of size on the main axis. This option makes column size equal to the total size of children inside.
  • Maximum(
    ): Make the column occupy the maximum size on the main axis. This option fills all the available space on the main axis.
To change the main axis size:
  1. 1.
    Select the Column from the widget tree or the canvas area.
  2. 2.
    Move to the Property Editor and scroll down to Main Axis Size.
  3. 3.
    Select either Minimum(
    ) or Maximum(
    ) option based on your requirement.
Minimum
Maximum

Adjust the Main Axis Alignment

The Main Axis for a Column Widget is the vertical axis, so adjusting this will change how the child widgets are vertically distributed in the column.
You can adjust the main axis alignment using the following options:
  • Start (
    ): Place children elements as close to the beginning as possible.
  • Center (
    ): Place children elements as close to the middle as possible.
  • End (
    ): Place children elements as close to the end as possible.
  • Space Evenly (
    ): Evenly space children elements.
  • Space Around (
    ): Place the free space evenly between the children with some extra space at the beginning and end.
  • Space Between (
    ): Place the free space evenly between the children.
To change the Main Axis Alignment:
  1. 1.
    Select the Column from the widget tree or the canvas area.
  2. 2.
    Move to the Property Editor and scroll down to Main Axis Alignment.
  3. 3.
    Select from the options displayed including Start, Center, End, Space evenly, Space between, and Space around.
The default Main Axis Alignment set to the Column is Start.

Adjust the Cross Axis Alignment

The Cross Axis for a Column Widget is the horizontal axis, so adjusting this will change how the child widgets are horizontally distributed in the column.
You can adjust the cross axis alignment using the following options:
  • Start (
    ): Place child elements as close to the beginning as possible.
  • Center (
    ): Place child elements as close to the middle as possible.
  • End (
    ): Place child elements as close to the end as possible.
  • Stretch (
    ): Make the child fill the cross axis (horizontally).
To change the Cross Axis Alignment:
  1. 1.
    Select the Column from the widget tree or the canvas area.
  2. 2.
    Move to the Property Editor and scroll down to Cross Axis Alignment.
  3. 3.
    Select from the options displayed including Start, Center, End, and Stretch.
The default Cross Axis Alignment set to the Column is Center.

Aligning widgets inside column

You can set the widgets' horizontal and vertical alignment inside the column. Additionally, there are two more alignment options for widgets inside of a parent widget:
  • Expanded (
    ): This option expands the widget to fill the available space of the main axis. For a column, this will be the vertical axis.
  • Flex (
    ): This option is only available when there are multiple widgets inside the column that are expanded. This option determines the proportion of space given to each widget. For example, if Widget A has Flex = 1 and Widget B has Flex = 2, then A will take up 1/3 of the available space, and B will take up 2/3 of the space.
  • When using an expanded widget, make sure to limit the height of the column. Using an unbounded column and an expanded widget will break your application.
  • Please note that scrollable columns are unbounded, so they should not be combined with expanded widgets.
To align widgets inside of column:
  1. 1.
    Select the widget and then select the right icon(
    ) under Expanded.
  2. 2.
    Similarly, set other widgets to Expanded. Now you will see the Flex property.
  3. 3.
    Try adding Flex properties for the expanded widgets (e.g., Widget A Flex = 1 and Widget B Flex = 2).

Making column scrollable

To make a column scrollable when there are several children, check the Scrollable box.
Scrollable Column

Showing empty list widget

See how to display an empty list widget when there is no data.

Showing backend data

You might be storing data on Firebase or your own server. Let's see how to load items and display them on the Column widget.
Backend Queries on a Column can cause performance issues if the number of items is >15. In that case, we recommend using a ListView or GridView instead.

1. Showing Data from Firestore

To show data from Firestore, create a collection, query a collection and then display the data.
Pictures collection
Showing pictures from Firestore

2. Showing Data from API call

You may be using your own infrastructure to store your app data. The data can be retrieved via API calls.

2.1 Prerequisites

Before we show data from an API call, make sure you incorporate all the mentioned prerequisites.
If you haven't set up API calls at your backend side yet, you can use any open API to try it out. Maybe you can try this https://picsum.photos/v2/list.
After adding an API call in FlutterFlow, it looks like this:

2.2 Making API call on a Column

Making an API call allows you to get a response (containing the list of items) and show them in the Column.
To make an API call on a Column:
  1. 1.
    Select the Column widget from the widget tree or the canvas area.
  2. 2.
    Click on the Backend Query tab (on the right side of your screen).
  3. 3.
    Set the Query Type to API Call.
  4. 4.
    Set the Call Name to the API Name that fetches the data.
  5. 5.
    Click Save.

2.3 Generating Dynamic Children

Generating dynamic children help you prepare a list of items present in the API response. The returned result is stored in a variable that you can use to populate the Column.
To generate dynamic children:
  1. 1.
    Select Column from the widget tree or the canvas area.
  2. 2.
    Click on the Generate Dynamic Children tab (on the right side of your screen).
  3. 3.
    Enter the appropriate Variable Name.
  4. 4.
    Set the Source value to the [apicall_name] Response (from Column).
  5. 5.
    Set the Response Options to JSON Body.
  6. 6.
    Under the Available Options, click on Unset and select the JSON Path.
  7. 7.
    Inside the JSON Path, enter the JSON expression to retrieve the list. See how to get JSON Path here.
  8. 8.
    Click Save.

2.4 Showing Data in UI Elements

To show an image from the URL stored inside the JSON key:
  1. 1.
    Select the Image widget, move to the properties panel, find the Path property and click on the Set from Variable text.
  2. 2.
    Select the [variable_name] item from the list. This should be the variable name you specified while Generating Children from Variable.
  3. 3.
    Set the Available Options to JSON Path.
  4. 4.
    Inside the JSON Path, enter the JSON expression to retrieve the image URL. See how to get JSON Path here.
  5. 5.
    Click Confirm.
Showing Data in UI Elements
Here's how it looks when you run your app:

Show/Hide Column

Please find the instructions to show/hide the widget here.
Last modified 3mo ago