Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you align widgets like CSS float with Flutter UI?

Tags:

flutter

Given some List<Widget>, how might I achieve the equivalent of CSS float left/right? I have a list of widgets with constant height, but variable width. I would like for them to be laid out like the image:

enter image description here

like image 766
R. C. Howell Avatar asked Jan 01 '18 16:01

R. C. Howell


People also ask

How do I move widgets in Flutter?

Widgets are moved by setting the alignment with Alignment , which has static properties like topCenter, bottomRight, and so on. Or you can take full control and set Alignment(1.0, -1.0) , which takes x,y values ranging from 1.0 to -1.0, with (0,0) being the center of the screen.


1 Answers

What you're looking for is Wrap widget.

new Wrap(
    direction: Axis.horizontal,
    crossAxisAlignment: WrapCrossAlignment.start,
    spacing: 5,
    runSpacing: 5,
    children: [
    ],
);
like image 56
Rémi Rousselet Avatar answered Oct 09 '22 20:10

Rémi Rousselet