How can I create line breaks within a long Text widget?
For example, I am creating a biographical page about myself. And I have three paragraphs I want to be able to dis
I'm assuming you already have some way in the original text to tell that there should be a line break such as \n
. If your paragraph is something like: var text = "paragraph1\n\nparagraph2";
, you could do something like the following:
var split = text.split('\n').map((i) {
if (i == "") {
return Divider();
} else {
return Text(i);
}
}).toList();
var displayElement = Column(children: split);
returning the displayElement
, which will have a divider element between each paragraph.