【问题标题】:How can i make a paragraph when writing a long text in flutter?在颤动中写长文本时如何制作段落?
【发布时间】:2021-07-06 07:51:42
【问题描述】:

如何在文本小部件中使段落颤动? 都是一篇长文,看起来很蠢

我想要的: 你好,

你好吗?

它是什么:

你好,你好吗?

【问题讨论】:

    标签: flutter text widget


    【解决方案1】:

    对段落使用\n,例如:Text('Hello,\n\nhow are you?')

    【讨论】:

    • 哦,这么简单,为什么我在 google 上找不到这么简单的东西?谢谢
    • 很高兴我能帮上忙!请考虑接受我的回答以获得一些声誉;)我在这里还是很新......
    • 两个箭头旁边应该有复选标记,您可以选择,如this question所示。
    【解决方案2】:

    另一种方法,使用 RichText:

    RichText(
          text: TextSpan(
            text: 'Hello,',
            style: TextStyle(color: Colors.black, fontSize: 18.0),
            children: <TextSpan>[
              TextSpan(
                text: 'how are you?',
                style: TextStyle(fontWeight: FontWeight.bold, )
              ),
            ],
          ),
        )
    

    【讨论】:

      猜你喜欢
      • 2021-02-24
      • 1970-01-01
      • 2018-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 1970-01-01
      • 2020-07-13
      相关资源
      最近更新 更多