Fluid layouts allows you to create responsive layout for mobile, web and desktop from a single codebase.

Related tags

UI fluid_layout
Overview

IMPORTANT! This package is now deprecated.

Consider using layout instead


Lava Clock

Fluid Layout

pub package

Demo: jamesblasco.github.io/fluid_layout

Fluid gif

Fluid layouts allows you to create responsive layout for mobile, web and desktop from a single codebase.

Let's get started

Install it

Follow the installation process here

Understand fluid layout

Fluid layout aims to help building a responsive experience through all the different screen sizes. Based in the boostrap approach, FluidLayout calculates a padding content (fluid_padding) that changes depending on the parent size. The Fluid widget uses that padding to set its size

The screen sizes are divided in 6 breakpoints: xs, s, m, l, xl, and can be accessed through FluidLayout.of(context).fluidBreakpoint or context.breakpoint.

You can create values(int, num, objects, functions, ... whatever variable type) for diferrent screen sizes thanks to the class FluidValue. The easiest way is:

final value = context.fluid(defaultValue, 
  xs: xsValue,  //if null xs would be defaultValue
  s:  sValue,   //if null s would be defaultValue
  m:  mValue,   //if null m would be defaultValue
  l:  lValue,   //if null l would be defaultValue
  xl: xlValue   //if null xl would be defaultValue
 ) 

Examples

FluidLayout & Fluid

See web example

class BasicFluidLayout extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[200],
      body: Container(
        child: FluidLayout(
          child: Fluid(
            child: Container(
              color: Colors.blue,
              child: Center(
                child: Text(
                  'Fluid width',
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

There is a fixed horizontalPadding param that can be changed to all the FluidLayout or just for a Fluid container

For CustomScrollView there is a SliverFluid equivalent to Fluid

FluidGridView

A staggered grid view that divides the width size in 12 columns and makes easy to build responsive grid layout

See FluidGridView web example

FluidGridView(
  children: List.filled(
    100,
    FluidCell.withFluidHeight(
      size: context.fluid(3, m: 3, s: 4, xs: 6), //max 12
      heightSize: context.fluid(3, m: 3, s: 4, xs: 6), // max 12
      child: Container(
        color: Colors.red,
        child: Center(child: Text('Item')),
      )),
    ),
)

Customizable params [double spacing, ScrollPhysics physics, bool shrinkWrap] and bool fluid

FluidCell has three methods to build the cell:

  • FluidCell.fit({size, child})
  • FluidCell.withFluidHeight({size, heightSize, child})
  • FluidCell.withFixedHeight({size, height, child})

For CustomScrollView there is a SliverFluidGrid equivalent to FluidGridView

Conditional Layout

See Conditional Layout web example

if(FluidLayout.of(context).fluidBreakpoint.isLargerThanM)
   return Container(color: Colors.red)
else
   return Container(color: Colors.green)              

Remember you can use context.breakpoint as FluidLayout.of(context).fluidBreakpoint

Combine full width widgets with fluid layouts

Fluid layouts can be built everywhere inside the app and they will calculate their constraints based on their parents sizes, also they can combine very easily in cases we need full screen widgets.

  1. Fluid layout with horizontal scroll rows

FluidValue

TBD

You might also like...

A flutter plugin for Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple.

A flutter plugin for Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple.

A flutter plugin for Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple.

Dec 29, 2022

Instagram social network interface in a responsive built using flutter

Instagram social network interface in a responsive built using flutter

Responsive Instagram 📱 Responsive Instagram foi um projeto realizado com o intuito de aprendizagem e prática da linguagem de programação Dart em conj

Jun 11, 2022

A responsive book app UI using flutter

Flutter Book Project I'm design a responsive book app UI using flutter, There is 3 page home page that includes a horizontal category list, then a lis

Dec 27, 2022

With flutter tags you can create selectable or input tags that automatically adapt to the screen width

With flutter tags you can create selectable or input tags that automatically adapt to the screen width

flutter_tags Create beautiful tags quickly and easily. Installing Add this to your package's pubspec.yaml file: dependencies: flutter_tags: "^0.4.9+

Dec 21, 2022

This package provides some widgets you can use to create a smooshy UI.

This package provides some widgets you can use to create a smooshy UI.

Dough Library Squishy widgets for Flutter. Quick Links Dough Demos Here are a few samples of the different widgets provided by this repo. You can find

Dec 23, 2022

Create mobile game store design using Flutter

Create mobile game store design using Flutter

Create mobile game store design using Flutter

Nov 25, 2022

Create mobile marketplace design using Flutter

Create mobile marketplace design using Flutter

On this Marketplace Design has two pages one for the product page which has a horizontal list of categories then a list of our products. Then on the details page, it shows the price, rating, total view, and description of the product with the Buy Now button.

Nov 25, 2022

This a fluttet mobile application UI. that create for Virtual Reality Store.

This a fluttet mobile application UI. that create for Virtual Reality Store.

Virtual Reality Store App Getting Started This a fluttet mobile application UI. that create for Virtual Reality Store. The app code is preloaded with

Nov 1, 2021

Flutter YouTube UI - Web & Mobile: Android | IOS

Flutter YouTube UI - Web & Mobile: Android | IOS

YouTube Clone UI - Flutter Mobile: IOS | Android Mobile Version: Android | IOS @luanbatistadev Open Source Copyright © 2021-present, Luan Batista. Fac

Sep 22, 2022
Owner
Jaime Blasco
Google Developer Expert in Flutter
Jaime Blasco
Responsive Sizer helps implement are responsive layout by providing helper widgets and extensions

Responsive Sizer Responsive Sizer helps implement a responsive layout by providing helper widgets and extensions Content Installation Parameters Take

CoderUni 71 Jan 3, 2023
I am trying to teach Responsive Ui design. This video for Web and Mobile. This design is suitable for Desktop, Tab, and Mobile platforms.

before clone the GitHub repository please give a star on the repository. I am trying to teach Responsive Ui design. This video for Web and Mobile. Thi

Blackshadow Software Ltd 22 Sep 1, 2022
A Flutter package consisting of pre animated cards(containers) with fluid animation for freely adding user customized cards to the app with heavy customizable options adding up to an incredible UI experience

A Flutter package consisting of pre animated cards(containers) with fluid animation for freely adding user customized cards to the app with heavy customizable options adding up to an incredible UI experience

Shantanu 12 Dec 30, 2022
The best swiper for flutter , with multiple layouts, infinite loop. Compatible with Android & iOS.

The best swiper for flutter , with multiple layouts, infinite loop. Compatible with Android & iOS.

null 3.4k Jan 3, 2023
Build flexible layouts with constraints, Similar to Android ConstraintLayout

Flutter ConstraintLayout Build flexible layouts with constraints, Similar to Android ConstraintLayout. No matter how complex the layout is and how dee

fangbing chen 247 Jan 5, 2023
Allows widgets to be zoomed in and out by inserting a OverlayEntry which allows the widget to be on the front at all times.

zoom_pinch_overlay An instagram style pinch and zoom widget for all platform completely written in pure dart! All other "zoom_pinch" package doesnt di

Samuel 18 Nov 29, 2022
A Flutter grid view which supports waterfall flow layout.

waterfall_flow A Flutter grid view easy to build waterfall flow layout quickly. Web demo for WaterfallFlow Language: English | 中文简体 waterfall_flow Use

FlutterCandies 290 Dec 29, 2022
Instagram UI designed with Flutter; it is compatible and responsive with any type of Android and iOS devices.

instagram Instagram clone UI designed with Flutter; it is compatible and responsive with any type of Android and iOS devices . Getting Started This pr

Mustafa Nabavi 4 Oct 28, 2021
Tour guide App UI in Flutter Consist of Three Pages. First Screen is Splash Screen , Second is welcome screen routing to third Screen and Third screen consist of details , navigation, places, and responsive UI.

Tour Guide // Tourism App Ui in Flutter. Tour Guid App Ui in Flutter. Visit Website Features State Management Navigation Bar Responsive Design Hybrid

Habib ullah 2 Nov 14, 2022
Responsive Admin Panel or Dashboard using Flutter

Responsive Admin Panel or Dashboard using Flutter

Abu Anwar 5.5k Dec 29, 2022