flutter/flutter

Add TextOverflow "ellipsisStart" , "ellipsisMiddle" and "ellipsisEnd"

oodavid opened this issue ยท 31 comments

Use case

When displaying file-paths, I'd prefer to show the file-name and clip the file-path.

In this example, it's not possible to see the filenames:

Text(
  '/root/sdcard/storage/camera/2019-11-20 12:12:11 a-file-with-a-long-path.png',
  overflow: TextOverflow.ellipsis,
)

Screenshot 2019-11-21 at 10 47 04

Proposal

Allow TextOverflow to clip text on the leading edge rather than the trailing edge.

As I said in #47543 I suggest TextOverflow.ellipsisStart, TextOverflow.ellipsisMiddleand TextOverflow.ellipsisEnd.

Why is this closed? has it been implemented? We definitely need this feature implemented.

It's open, you are confusing a closed issue referenced at the end of this one.

@feinstein
Thank you for the clarification, since November and yet no one has been assigned to this issue :( how can we escalate it?

Give it a ๐Ÿ‘๐Ÿป (as they prioritize based on thumbs up count) and hope someone will get to fix it.

Please assign someone to this feature. Or please add a Cupertino Text field widget, as it is already implemented on iOS.

Please assign someone to this feature. Or please add a Cupertino Text field widget, as it is already implemented on iOS.

@trqalothman
can you please link the docs where it says that Cupertino Text field widget supports ellipsis at start? I cannot see it in the docs.

@ajain-bst

I apologize, maybe I was not clear enough, I did not read this on the documentation, but I just remember when I used to develop apps using xcode, once you add a text box you can adjust the attributes on the right side, all three options of truncation available. Either at the start, middle, or end.

Here is the link for the Truncation property of Label, it is called line break and you can set it as "Truncate Head", "Truncate Middle", and "Truncate Tail". In flutter it only implements "Truncate Tail" and not the others.

https://developer.apple.com/documentation/swiftui/text/truncationmode/middle

need this feature too

@iapicca I want to know when this feature will be added?

@sm2017 no idea, but the lack of priority label doesn't seem promising

I recommend discussing questions on the handling of (any) issue on discord

https://pub.dev/packages/extended_text support this feature now. you can define it as following:

enum TextOverflowPosition {
  start,
  middle,
  end,
}
  ExtendedText(
   overflowWidget: TextOverflowWidget(
     position: TextOverflowPosition.end,
     align: TextOverflowAlign.center,
     // just for debug
     debugOverflowRectColor: Colors.red.withOpacity(0.1),
     child: Container(
       child: Row(
         mainAxisSize: MainAxisSize.min,
         children: <Widget>[
           const Text('\u2026 '),
           InkWell(
             child: const Text(
               'more',
             ),
             onTap: () {
               launch(
                   'https://github.com/fluttercandies/extended_text');
             },
           )
         ],
       ),
     ),
   ),
  )

image

https://pub.dev/packages/extended_text support this function now. you can define it as following:

@zmtzawqlp
nice to have a 3rd party package!
but I feel that this feature should be first party with "first party grade" testing and such

https://pub.dev/packages/extended_text support this feature now. you can define it as following:

Extended Text doesn't support Flutter Master Channel so this isn't a successful work around for everyone:
fluttercandies/extended_text_field#80 (comment)

Would be nice if TextOverflow had "ellipsisStart", "ellipsisMiddle", and "ellipsisEnd" and would just be passed to Text.overflow

Text(
  'Hello World'
  overflow: TextOverflow.ellipsisStart
)

I think this should be a standard feature, not needing 3rdparty packages.

This is a major design issue, I am unable to implement font size adjustments as a setting in my app due to this feature not being implemented as any font increase will render my app useless and it will mess up all of my design :(

2019 -> 2020 -> 2021 -> ...
How can we raise the priority? :)

@TahaTesser I believe this feature could be very important for desktop as it deals with file paths much more than mobile

@nailgilaziev

Someone has to do a pull request on the flutter channel for this feature I guess!

Ltei commented

Hi! We need this, is there any udate?

Hi, this definitely should be considered to be implemented as soon as possible!

Any progress on this? This feature is very useful, native android has it from the beginning..

We need this feature

any news?

2023

z-chu commented

2024

:( i want this too

This is a very basic feature that everyone needs. Please update it as soon as possible. Thanks. 2023^_^

Hello guys! You can use Text.rich and WidgetSpan with Text inside it. Then wrap Text.rich and Text both with Transform.flip with flipX: true. It works and you don't need 3rd party libraries

image image image