How to add custom overflow string in `Text` or `TextSpan`?
Mericusta opened this issue Β· 18 comments
Text
uses RichText
and RichText
uses RenderParagraph
which also doesn't take a custom value
uses _kEllipsis
You would need to create a custom clone of RenderParagraph
.
Text
usesRichText
andRichText
usesRenderParagraph
which also doesn't take a custom valueflutter/packages/flutter/lib/src/rendering/paragraph.dart
Line 64 in d927c93
ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null,
uses_kEllipsis
You would need to create a custom clone of
RenderParagraph
.
for more, it better to provide the way to custom the ellipsis style, and the ellipsis like "...read more" should be to be tapped.
@Mericusta hi guy, there is a workaround for this issue , see does it help for you.
the same issue to me? have some good way?
This feature would be really nice to have. I would like to customize the ellipsis to "...continue reading".
Using the extended_text
package seems overkill to me, we only need to be able to simply replace a string by another.
If there was a way to override _kEllipsis that would be great, for example by adding an overflowText
parameter to the widgets's constructors that use TextOverflow.ellipsis
.
We could resolve this with a ignoreOverflow
property on a TextSpan. That way we can add a text span after the ...
ellipsis in any color and with a gesture recognizer.
https://github.com/fluttercandies/extended_text οΌsupport Widget as TextOverflow now.
I want to give this a shot.
@zoechi Just checking if there is anything I should keep in mind while working on this.
Using the
extended_text
package seems overkill to me, we only need to be able to simply replace a string by another.If there was a way to override _kEllipsis that would be great, for example by adding an
overflowText
parameter to the widgets's constructors that useTextOverflow.ellipsis
.
It would be better if the type was InlineSpan
instead of String
. Then we could use any widget like TextSpan(text: '...', children: [ WidgetSpan(child: Icon(Icons.done) ])
.
I would like to work on this and provide option to add custom widget instead of just text.
I would like to work on this and provide option to add custom widget instead of just text.
Thanks @campovski. Feel free to open a PR and link it to this issue.
@campovski Glad to see someone's on it. It's now Apr 2023. Any progress so far?
This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This issue was assigned to @campovski but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
Would love this feature as well!