Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix widget in bottom space

I need some help with a layout.

I need put some widgets inside a "Scrollview" but keep the buttoms in the bottom space of screen.

Image with a "Scrollview" with some textFields inside, and under de "Scrollview" a Rows containing two buttons

So if I change orientation the Layout will keep buttons at bottom and will scroll the widgets above.

How can I made it in flutter, I tried to use the Stack, Listview and others approaches, but i didn't have luck

like image 705
Cristiano Winter Avatar asked Jul 05 '18 13:07

Cristiano Winter


People also ask

How do I fix a widget at the bottom of my screen Flutter?

All we have to do is wrap the child widget into Align widget and set the alignment using its property and you see the magic.

How do you position a widget at the bottom of a SingleChildScrollView?

Center the widgets and push them from top to bottom with padding.


1 Answers

Multiple ways. I recommend you either using a Scaffold or a Column:

If you are already using a Scaffold in your app, just add bottomNavigatorBar as a Parameter, your bar you want to have at the bottom in it and make sure the rest of your layout is located under it's body tag.

Otherwise you could use a Column:

Column( 
children: <Widget> [ 
Expanded(child:ScrollView(..),),
 yourBottomBar, 
] )

Or Flutter also has a Positioned widget which you can use in combination with a Stack:

Stack(
  children: [
    // some stuff
    Positioned(
      bottom: 0,
      child: yourBottomBar
    ),
  ],
)
like image 166
Bostrot Avatar answered Nov 15 '22 11:11

Bostrot