长文本颤动中的换行符 [英] Line Breaks in Long Text Flutter

查看:58
本文介绍了长文本颤动中的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在长文本控件中创建换行符?

How can I create line breaks within a long Text widget?

例如,我正在创建有关自己的传记页面。我想展示三段。但是目前,我正在一个大型Text Widget中输出这些段落,并且输出中没有换行符以区分这些段落。我该怎么办?

For example, I am creating a biographical page about myself. And I have three paragraphs I want to be able to display. But currently, I am outputting those paragraphs in one big Text Widget and the output does not have line breaks to differentiate the paragraphs. How can I do that?

推荐答案

像这样声明您的文本:

final String someText = 
"stuff for the 1st paragraph\n\n"
"stuff for the 2nd paragraph\n\n"
"stuff for the 3rd paragraph\n\n";

然后可以将其呈现在 Text 小部件像往常一样。

and then you can just render it inside of a Text widget like you normally would.

这篇关于长文本颤动中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆