Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add custom overflow string in Text or TextSpan? #26748

Open
Mericusta opened this issue Jan 18, 2019 · 18 comments
Open

How to add custom overflow string in Text or TextSpan? #26748

Mericusta opened this issue Jan 18, 2019 · 18 comments
Labels
c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@Mericusta
Copy link

Mericusta commented Jan 18, 2019

image

I want to replace overflow string '\u2026' to something else, like '...read more'.

@Mericusta Mericusta changed the title text wrap How to add custom overflow string in 'Text' or 'TextSpan' ? Jan 18, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 18, 2019

Text uses RichText and RichText uses RenderParagraph which also doesn't take a custom value

ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null,

uses _kEllipsis

You would need to create a custom clone of RenderParagraph.

@zoechi zoechi added c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. labels Jan 18, 2019
@zoechi zoechi added this to the Goals milestone Jan 18, 2019
@zmtzawqlp
Copy link
Contributor

Text uses RichText and RichText uses RenderParagraph which also doesn't take a custom value

flutter/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.

@zmtzawqlp
Copy link
Contributor

@Mericusta hi guy, there is a workaround for this issue , see does it help for you.

@OHeroJ
Copy link

OHeroJ commented Apr 15, 2019

the same issue to me? have some good way?

@zmtzawqlp
Copy link
Contributor

@kf6gpe kf6gpe changed the title How to add custom overflow string in 'Text' or 'TextSpan' ? How to add custom overflow string in Text or TextSpan? Jan 7, 2020
@rayliverified
Copy link

This feature would be really nice to have. I would like to customize the ellipsis to "...continue reading".

@mr-mmmmore
Copy link

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.

@lukepighetti
Copy link

lukepighetti commented Mar 4, 2020

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.

@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@zmtzawqlp
Copy link
Contributor

https://github.com/fluttercandies/extended_text ,support Widget as TextOverflow now.

@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@pedromassango
Copy link
Member

I want to give this a shot.
@zoechi Just checking if there is anything I should keep in mind while working on this.

@darkstarx
Copy link

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.

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) ]).

@AbhijithKonnayil AbhijithKonnayil mentioned this issue Aug 2, 2022
8 tasks
@campovski
Copy link
Contributor

I would like to work on this and provide option to add custom widget instead of just text.

@pedromassango
Copy link
Member

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.

@jagged3dge
Copy link

@campovski Glad to see someone's on it. It's now Apr 2023. Any progress so far?

@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team and removed triaged-framework Triaged by Framework team labels Jul 8, 2023
@flutter-triage-bot
Copy link

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!

@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Jul 30, 2023
@flutter-triage-bot
Copy link

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.

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label Aug 1, 2023
@Piinks Piinks added the triaged-framework Triaged by Framework team label Aug 1, 2023
@seanhamstra
Copy link

Would love this feature as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests