简体   繁体   中英

Flutter pdf plugin long text is not going in new line

I am using a plugin

pdf: ^3.7.1

On Using Following Code

pw.Text(Very Long Text,
    style: pw.TextStyle(
              fontSize: 20,
           ),
),

The very long text is not going in a new line it's going out of the bound of the page. 在此处输入图像描述

As you can see the text is cut after reaching the end. Even on using paragraph same happened.

That happens because that package can't "go inside" a single widget and split it in order to make it fit the page (or, in other cases, to create a new page). You have to either wrap the text yourself and make it a multiline widget, or split the text yourself (maybe using something like CR or LF as separator) and divide it over different widgets.

Wrap your Text in SizedBox and give it a width

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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