【问题标题】:How to write OR in between line in flutter如何在颤动的行之间写 OR
【发布时间】:2021-11-08 05:33:09
【问题描述】:

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

注意: OR 居中

【问题讨论】:

  • 行小部件,带有线条的扩展小部件,为您的文本添加一些水平填充,添加另一个带有线条的扩展小部件。
  • 如何添加该行?分频器有帮助吗?

标签: flutter dart flutter-layout flutter-text


【解决方案1】:

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

here 用于扩展小部件,here 用于灵活小部件

  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,
            ),
          ),
        ],
      ),
    ),

你的结果屏幕喜欢 ->

【讨论】:

    【解决方案2】:

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

    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 登录屏幕时就是这样

    【讨论】:

      猜你喜欢
      • 2020-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-23
      • 2021-01-28
      • 2020-11-29
      • 2019-06-02
      相关资源
      最近更新 更多