Horizontal divider with text in the middle in Flutter?

前端 未结 6 1588
不思量自难忘°
不思量自难忘° 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:05

    To expand on Jerome's answer - Here is an example that shows how to embed it with other content and also has additional edgeinsets for coming closer to the actual picture that you want:

              Column(children: [
                Row(
                  children: [Text("above")],
                ),
                Row(children: [
                  Expanded(
                    child: new Container(
                        margin: const EdgeInsets.only(left: 10.0, right: 20.0),
                        child: Divider(
                          color: Colors.black,
                          height: 36,
                        )),
                  ),
                  Text("OR"),
                  Expanded(
                    child: new Container(
                        margin: const EdgeInsets.only(left: 20.0, right: 10.0),
                        child: Divider(
                          color: Colors.black,
                          height: 36,
                        )),
                  ),
                ]),
                Row(
                  children: [Text("below ")],
                ),
              ])
    

提交回复
热议问题