How to add `overflow` to SelectableText in Flutter?
895
Just experienced this.
The problem is overflow
hasn't been made the top level parameter in case of SelectableText
as with Text
in Flutter which suggests that it must be there, just not as the top level parameter which is true as it is in TextStyle
.
Hence, to use overflow
in SelectableText
, change
SelectableText(
text,
overflow: TextOverflow.ellipsis
)
to
SelectableText(
text,
style: TextStyle(
overflow: TextOverflow.ellipsis,
),
)
Author by
Andriy Antonov
Updated on December 29, 2022Comments
-
Andriy Antonov about 1 year
There is
SelectableText
widget that allows you to make text selectable. But it misses theoverflow
parameter, which is required...Is there any workaround, which can make it work? Or a similar solution? Thanks!
-
KuKu almost 3 yearsI think that all text should be shown to select text.
-
KuKu almost 3 yearsIf you use 'maxLines' parameter, you can limit vertical spread.
-
Andriy Antonov almost 3 years@kuku not exactly. it will limit the number of lines, but they will become scrollable, which is terrible...
-