Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display buttons side-by-side in Flutter?

Tags:

I would like to display both of my buttons next to each other horizontally. So far I can only display them from top to bottom.

With the following code, what would I have to change ?

new Container(     child: new Column(        children: <Widget>[        new RaisedButton(         child: new Text("LogIn"),         color:  Colors.blueAccent[600],         onPressed: null,         ),         new RaisedButton(         child: new Text("SignUp"),         color:  Colors.blueAccent[600],         onPressed: null,         ),         ],     ),   ), 
like image 848
DESH Avatar asked Mar 14 '18 14:03

DESH


People also ask

How do you add two buttons on Flutter?

Use Wrap() widget to add multiple floating action buttons.

How do you stack positions in Flutter?

Here's how you do it: Step 1: Wrap the Stack's child widget inside the Position widget. Step 2: Inside the Position widget, add the top , right , bottom , left property and give it a value. For example, setting top:15 and right:0 will position a widget on the top right of your screen with 15 px space from the top.


1 Answers

Column is for items vertically arranged (hence a column), you are looking for Row. Just replace Column with Row, the rest of the code is fine. You can also use an Expanded if you want to fill all the available space.

like image 196
Rene Avatar answered Sep 22 '22 10:09

Rene