Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Vertical Divider

Tags:

flutter

In Flutter, is there an option to draw a vertical lines between components as in the image.

enter image description here

like image 390
Praveen Kumar Avatar asked Mar 20 '18 15:03

Praveen Kumar


People also ask

How do you add a vertical divider in textfield in flutter?

How to Add Vertical Divider: VerticalDivider( color: Colors. black, //color of divider width: 10, //width space of divider thickness: 3, //thickness of divier line indent: 10, //Spacing at the top of divider. endIndent: 10, //Spacing at the bottom of divider. )

How do you change the height of the vertical divider in flutter?

The divider is placed inside a Container>Row>Column->Container and divider's height should be the height of a Column.

How do you put a divider in flutter?

If you have a list of widgets, you may need to add a separator between the widgets. In Flutter, there are two widgets suitable for that purpose: Divider and VerticalDivider . Divider is used to create a horizontal line divider, while VerticalDivider is used to create a vertical line divider.


2 Answers

Not as far as I know. However, it is quite simple to create one — if you look at the source for Flutter's Divider you'll see that it is simply a SizedBox with a single (bottom) border. You could do the same but with dimensions switched.


Update (Oct 4, 2018): a VerticalDivider implementation has been merged in by the Flutter team. Check out the docs but it's very simple to use — simply put it between two other items in a row.

Note: If you are using VerticalDivider as separator in Row widget then wrap Row with IntrinsicHeight , Container or SizedBox else VerticalDivider will not show up. For Container and SizedBox widget you need define height.

like image 68
rmtmckenzie Avatar answered Sep 28 '22 21:09

rmtmckenzie


As of 10 days ago, flutter has merged a VerticalDivider implementation. It will be available in the default channel very soon, but for now you have to switch to the dev channel to use it: flutter channel dev.

Here is a example of how to use it:

IntrinsicHeight(     child: new Row(   mainAxisAlignment: MainAxisAlignment.spaceEvenly,   children: <Widget>[     Text('Foo'),     VerticalDivider(),     Text('Bar'),     VerticalDivider(),     Text('Baz'),   ], )) 
like image 23
jgillich Avatar answered Sep 28 '22 22:09

jgillich