Horizontal divider with text in the middle in Flutter?

前端 未结 6 1705
不思量自难忘°
不思量自难忘° 2021-02-01 03:13

Is there a built in widget in Flutter to create a divider with text in the middle? Any guide on how to do it? Like this: (the \"OR\" text in the middle of horizontal line)

6条回答
  •  你的背包
    2021-02-01 04:00

    You can simply use a container to achieve this:

    new Container(height: 40, width: 1, color: Colors.grey,
                            margin: const EdgeInsets.only(left: 10.0, right: 10.0),),
    

    If you want a vertical line, change the height for the size of it and control the "thickness" of your line with width.

    Invert these logic between width / height if you want to draw an horizontal line.

    Use it in a Row with your text in the middle of both of your containers.

提交回复
热议问题