In Flutter, you can use Text
the component to display text. By default, Text
components will wrap text whenever the text content exceeds the width of its container.
You can use Text
the component's softWrap
prop to control whether the text wraps automatically. If set softWrap
to true
(the default), the text will automatically wrap; if set softWrap
to false
, the text will not automatically wrap, but will exceed the boundaries of its container.
Text
For example, the following code creates a component that does not wrap :
Text(
'这是一行长文本,它不会自动换行。',
softWrap: false,
),