# Responsive Layout

> This page is about FlutterFlow Studio (the visual builder), not FlutterFlow (the app builder you use by describing your app).

URL: https://docs.flutterflow.io/concepts/layouts/responsive

Learn how to create responsive layout in your FlutterFlow Studio app.

FlutterFlow Studio is great at creating applications adaptable to a wide range of screen sizes, devices, and platforms. Ensuring that our screens maintain their aesthetic appeal across all these variations is crucial. Below, we outline various methods to enhance the responsiveness of your UI screens.

**Note:** 
Please check out the examples in the order they're given, as they use the same 
example. Jumping to sections might make things confusing.

### Global Properties

Let's start by demonstrating how screen width and height values change when you switch between devices in Test Mode. 

First, create a new project. In the Home Page, under a Column parent, add two Text widgets. Label one "Screen Width" and the other "Screen Height."

![The widget tree and canvas of a page where a Column holds two Text widgets that show Screen Width and Screen Height.](https://docs.flutterflow.io/assets/images/screen-width-height-light-249abf8bedf7c73d17fb60ecb94185a2.png)

Next, we'll display the changing values alongside these titles. For each Text widget, set its value to a variable. Select *Combine Text* from the options. Your first Text value should be either "Screen Width: " or "Screen Height: ".

Then, add another Text value that will show the corresponding value. This second Text value is also set from a variable. Choose 'Global Properties,' and then select either 'Screen Width' or 'Screen Height' from the list. These options hold the current screen width/height values. Repeat this process for both Text widgets.

![The Set from Variable menu with Global Properties expanded, listing Screen Width and Screen Height.](https://docs.flutterflow.io/assets/images/setting-global-properties-light-a302f168b075824356cad6d75bb04467.png)

Now, when you switch to Test Mode and try out different devices, you'll see the screen width and height values update accordingly.

**Running app on Test Mode for desktop device sizes**

![running-app-on-test-mode-for-desktop-device-sizes.avif](https://docs.flutterflow.io/assets/images/running-app-on-test-mode-for-desktop-device-sizes-a33815a0c05375fd8501943ab6d49d17.avif)

**Running app on Test Mode for mobile device sizes**

![running-app-on-test-mode-for-mobile-device-sizes.avif](https://docs.flutterflow.io/assets/images/running-app-on-test-mode-for-mobile-device-sizes-52410bce4805003848c8de270648d02a.avif)

This is to show you that these screen values are always accessible as global properties. You can use them to design your UI logic effectively.

## Expanded & Flex

Let's explore a fundamental method to make columns and rows adapt to different screen widths and heights. While designing a Row or Column, it's important to avoid assigning fixed sizes to the children, unless specifically required by the design.

Take, for instance, the navigation bar we're creating for our web version. It includes the page name, several navigation icons, and a search bar. Notice how the search bar adjusts its length based on the available width. This adaptability is achieved because the widths of the children are set relative to the available space in the horizontal section.

![web-version-of-our-shopping-app-example.gif](https://docs.flutterflow.io/assets/images/web-version-of-our-shopping-app-example-aa9a2440bf6f2a5e6b5b3e8b0ba3922f.gif)

To design the same navbar, create the following widget hierarchy:

```
- Container (named as webHeader)
       - Row
             - Row
             - TextField (named as searchBar)
             - IconButton
```

The second Row is further broken down into the following:

```
- Row 2
    - Text (named as pageName)
    - Row 3 (named as navIcons)
        - IconButton
        - IconButton
        - IconButton
```

The Widget Tree labels both nested rows **Row**. The names `Row 2` and `Row 3` only tell them apart in this guide.

![Widget Tree showing ProductList > Column > webHeader > Row with a nested Row (pageName, navIcons with three IconButtons), searchBar, and IconButton, next to the canvas with the header Row selected.](https://docs.flutterflow.io/assets/images/row-breakdown-light-47d35a3da8a6c330b58b2732b63f0a22.png)

A TextField inside a Row needs a width or an Expansion setting, so set the `searchBar`'s Expansion to *Expanded* (the third icon) for now. The search bar then occupies the maximum available space. However, we want both `Row 2` and the `searchBar` to share the space equally. To achieve this, simply adjust the Widget properties.

For `Row 2`, set its Expansion property to *Flexible* (the middle icon) and assign a Flex value of 1. Repeat the same steps for the `searchBar`. This change ensures they are allocated space in a 1:1 ratio, based on what's available. After this adjustment, you'll notice that the remaining space, following the placement of the *search IconButton* on the right, is evenly divided between `Row 2` and the `searchBar`.

![Editor with searchBar selected in the Widget Tree, the header split evenly on the canvas, and the Expansion row set to Flexible with a Flex value of 1.](https://docs.flutterflow.io/assets/images/test-expansion-light-07e2f9151bb05f282277599ef74aa5dc.png)

We encourage you to test with different web dimensions and sizes to see how well this adapts.

Depending on your design needs, there are various approaches to managing space. Let's consider a different scenario: What if we want the searchBar to always occupy 40% of the screen width, with `Row 2` taking up the remaining space after placing the `searchBar` and `search IconButton`?

To do this, first set the `searchBar`'s **Width** to 40 with **%** selected, and then set its Expansion to *Default* (the first icon). Set the width first, because the editor doesn't let a TextField in a Row use *Default* without one.

![searchBar properties with Expansion set to Default and Width set to 40 with % selected.](https://docs.flutterflow.io/assets/images/set-searchbar-light-f8395397b97e037426e88d14d07bc5f8.png)

Next, adjust the `Row 2` widget's Expansion setting to *Expanded* (the third icon). With these settings, you'll see that `Row 2` now occupies all the space left over after allocating 40% to the `searchBar` and placing the `search IconButton`.

Note: We've also styled the `searchBar` with a fill color, rounded corners, and a prefix icon to improve its appearance.

![ProductList page with the Categories title and nav icons on the left, a 40% width search bar reading 'Search for your shoes...' and a search icon on the right, and three category cards below.](https://docs.flutterflow.io/assets/images/enhanced-searchbar-light-f8e130f367d4022846c379ea279aa952.png)

You can also go ahead and improve the spacing between the `pageName` and `navIcons` by adjusting the MainAxisAlignment to *Space Between* (represented by the last icon).

Feel free to try this out with different screen sizes to see how it effectively adapts to the available space.

## Wrap method

Another effective method to enhance the responsiveness of a row or column containing multiple items is through the use of the Wrap widget.

Let's consider a scenario with a Row of category cards.

![Widget Tree with a Row selected that holds card1, card2, and card3, next to the canvas showing three category cards: Limited Edition, Casual Shorts, and Shoes.](https://docs.flutterflow.io/assets/images/row-of-cards-light-e186995309f270ad45451cb42d93b865.png)

You might observe that when the screen size is adjusted to resemble mobile dimensions, the cards begin to get cut off at the edges.

![row-card-resize.gif](https://docs.flutterflow.io/assets/images/row-card-resize-c2acaeb8d8830a78f3662c0d9f63e380.gif)

To resolve this issue, simply replace the parent Row widget with a Wrap widget.

Make sure to set the Wrap Direction to 'Horizontal' in the Wrap properties. You'll then see that the previously overflowing cards neatly move to the next line, as illustrated in the example.

![row-card-resize.gif](https://docs.flutterflow.io/assets/images/row-card-resize-2-f65d7398b92533417391457ad854c746.gif)

The Wrap widget efficiently manages layout for varying screen sizes by automatically adjusting its children into multiple rows or columns. It prevents overflow and ensures a clean, responsive design, especially useful for adapting content like category cards from desktop to mobile views.

## Responsive Breakpoints

Moving on to more complex layout scenarios, where the UI significantly differs between mobile and web platforms, it's important to first understand breakpoints.

**Breakpoints** in responsive design are like thresholds for different screen sizes. They act as specific points where the layout of a user interface meets a certain screen size requirement and then changes to accommodate it. When the screen size crosses one of these thresholds, the layout adjusts.

FlutterFlow Studio has default breakpoints for different screen sizes, but you can also adjust these to better suit your app's design needs.

### Customize Responsive Breakpoints

Open the **Theme** panel, and under **Design system & app theme**, click **Breakpoints**. The popover shows the widest screen, in pixels, that each layout applies to. You can change these values if needed.

![Theme panel filtered to Design system & app theme > Breakpoints, with the Breakpoints popover showing Mobile up to 599, Tablet up to 899, Tablet (landscape) up to 1199, and Desktop for everything wider.](https://docs.flutterflow.io/assets/images/custom-responsive-breakpoints-light-646957a8f878ea93c746e5ca3adef6cb.png)

The following sections will also rely heavily on *Responsive Visibility,* so let's proceed.

## Visibility of Nav Bar & App Bar

In many designs, the App Bar and Nav Bar are typically included in mobile or mobile + tablet screens, and often omitted in desktop formats. FlutterFlow Studio makes it easy to enable or disable the Nav Bar and App Bar.

Just go to App Settings, select Nav Bar & App Bar, and toggle the 'Show Nav Bar' option. Upon enabling it, the **Responsive Visibility** icons appear next to the toggle. Icons for mobile, tablet, tablet (landscape), and desktop let you choose where the Nav Bar should appear. The Nav Bar needs at least two pages, which you add under **Pages**.

Generally, it's advisable to enable it only for mobile, or mobile and tablet. Let's follow these steps to configure it for our app.

![App Settings with Nav Bar & App Bar selected, Show Nav Bar on, and Responsive Visibility set to mobile and tablet only, with the Layout preview and the ProductList and LayoutDemo pages listed under Pages.](https://docs.flutterflow.io/assets/images/appbar-navbar-visibility-light-bda5aa849d880a67860130c4114ac03c.png)

Now, when testing directly in our editor, observe how the navbar appears only for mobile and tablet screen sizes. This same approach can be applied to the App bar as well.

![appbar-navbar-visibility-resize.gif](https://docs.flutterflow.io/assets/images/appbar-navbar-visibility-resize-2aad6b0af11e814a4f0dbbf3ac048507.gif)

## Responsive Visibility

In our previous examples, we improved many aspects, but some responsive issues still remained. For instance, our NavBar displayed the same navigation icons on both top header and bottom navbar. Additionally, when the screen width was reduced to mimic mobile dimensions, the header elements became cramped and difficult to interact with.

To address this, we can leverage FlutterFlow Studio's Responsive Visibility feature to implement distinct AppBar and SearchBar designs for mobile, while maintaining the current design for web.

Imagine we've created a new widget, `mobileAppBar` , and added it to our layout. This widget cleverly separates the categories header and search bar vertically and includes a back navigation button. The goal is to activate this mobile-friendly layout for mobile and tablet screens, while preserving the 'webHeader' for tablet (landscape) and desktop views.

![responsive-visibility.avif](https://docs.flutterflow.io/assets/images/responsive-visibility-748f5a277989829f4c2427b745a218c8.avif)

To implement this, we can go to its widget properties and toggle the device icons as shown in the following demo.

<div style={{
    position: 'relative',
    paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
    height: 0,
    width: '100%'}}>
    <iframe 
        src="https://www.loom.com/embed/5ef35754c19c427997eefb3182b0b28a?sid=c1ac1ef9-de7d-4517-b86f-df5f8ba5f1e6"
        title=""
        style={{
            position: 'absolute',
            top: 0,
            left: 0,
            width: '100%',
            height: '100%',
            colorScheme: 'light'
        }}
        frameborder="0"
        loading="lazy"
        webkitAllowFullScreen
        mozAllowFullScreen
        allowFullScreen
        allow="clipboard-write">
    </iframe>
</div>
<p></p>

And now you have a more responsive screen for this shopping app use case that looks good in both mobile and desktop formats.

With these adjustments, your shopping app now boasts a highly responsive screen that seamlessly adapts to both mobile and desktop formats. This ensures an optimal user experience across all devices, maintaining both functionality and aesthetic appeal.

## Responsive Value

**Responsive Values** allow you to define different property values, such as widths, heights, font sizes, or padding, for different device sizes (mobile, tablet, desktop, and wide). At runtime, your app evaluates the screen width and automatically applies the appropriate value based on your configurations.

:::note[possible use cases]

- **Adaptive Layouts**: Automatically adjust element sizes to deliver a consistent UI across devices.
- **Better Readability**: Increase font size on larger screens to improve legibility.
- **Improved Spacing**: Use different padding or margins on tablets and desktops to optimize content flow.

:::

To set a responsive value, select a widget and choose a property that supports responsiveness. Click **Set from Variable > Responsive Value**, then enter different values for each screen size:

- Mobile (below `Breakpoint Small`)
- Tablet (below `Breakpoint Medium`)
- Desktop (below `Breakpoint Large`)
- Wide (above `Breakpoint Large`)

As you preview on different devices, the property will automatically adjust based on the selected screen size.

:::tip[Customizing Breakpoints]

You can adjust the default screen size breakpoints (mobile, tablet, desktop, wide) in FlutterFlow Studio’s **Theme** panel. See how to [**Customize Breakpoints**](#customize-responsive-breakpoints).

:::

<div style={{
    position: 'relative',
    paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
    height: 0,
    width: '100%'}}>
    <iframe 
        src="https://demo.arcade.software/0XfY0BCqlcIrsXhOGlCh?embed&show_copy_link=true"
        title=""
        style={{
            position: 'absolute',
            top: 0,
            left: 0,
            width: '100%',
            height: '100%',
            colorScheme: 'light'
        }}
        frameborder="0"
        loading="lazy"
        webkitAllowFullScreen
        mozAllowFullScreen
        allowFullScreen
        allow="clipboard-write">
    </iframe>
</div>
<p></p>
