1

大家好,我是新来的颤振并试图写成OR如图所示的水平线,但我不知道该怎么做,我试图用谷歌搜索它,但这对我的 示例演示没有帮助

注: OR 居中

4

2 回答 2

2

试试下面的代码希望它对你有帮助。您必须使用这种(--或--)类型的设计扩展灵活小部件

转到此处查看扩展小部件和此处查看灵活小部件

  Padding(
      padding: EdgeInsets.all(8.0),
      child: Row(
        children: [
          Expanded(
            child: Divider(
              color: Colors.black,
              thickness: 1,
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Text('OR'),
          ),
          Expanded(
            child: Divider(
              color: Colors.black,
              thickness: 1,
            ),
          ),
        ],
      ),
    ),

你的结果屏幕像 ->在此处输入图像描述

于 2021-09-13T02:13:59.350 回答
1

以下是使用行小部件的解决方案

Row(children: const [
                Expanded(child: Divider(thickness: 1.5)),
                Text("OR",
                    style: TextStyle(fontSize: 20, color: Colors.grey)),
                Expanded(child: Divider(thickness: 1.5)),
              ]),

当我尝试创建 Instagram 登录屏幕时就是这样

在此处输入图像描述

于 2021-09-12T18:12:38.797 回答