How does Flutter display long string?

2022/12/11 15:23

Flutter is a cross-platform mobile app framework that can be used to develop Android and iOS apps. To reasonably display TXT long articles, you can use a scrollable component in Flutter, such as SingleChildScrollView or Listed. This allows users to scroll to view the text. For example:

SingleChildScrollView(

Child: Text(context),

)

In this example, we wrapped a Text component with the SingleChildScrollView component to be able to scroll through the display.

Also, you can limit the number of lines displayed by text by setting the marlines property of the Text component. For example:

Text(

context,

marlines: 10,

)

This limits the display of text to 10 lines, and the excess is hidden. If you want users to be able to see hidden text, you can use the Expanded component to wrap the text automatically, or the scrollable component to scroll through viewing.

Back to top