简体   繁体   English

如何在文本小部件中的 flutter 中制作段落?

[英]How can I make paragraphs in flutter in a text widget?

How can I make paragraphs in flutter in a text widget?如何在文本小部件中的 flutter 中制作段落? Can't I use like android java string file in flutter?我不能在 flutter 中使用 android java 字符串文件吗?

You can do it in different ways in Flutter.您可以在 Flutter 中以不同的方式进行操作。 I suggest two options:我建议两种选择:

return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            RichText(
              text: TextSpan(children: [
                TextSpan(text: 'Text 2'),
                TextSpan(text: 'Text 2'),
              ]),
            ),
            RichText(
              text: TextSpan(children: [
                TextSpan(text: 'Text 3'),
                TextSpan(text: 'Text 4'),
              ]),
            ),
            Text('Line 1\nLine 2'),
          ],
        ),
      ),
    );
  1. RichText富文本
  2. Put \n in your text.将 \n 放入您的文本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM