flutter icon indicating copy to clipboard operation
flutter copied to clipboard

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

Open oodavid opened this issue 6 years ago • 36 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.

Internal bug - b/180975303

oodavid avatar Nov 21 '19 10:11 oodavid

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

feinstein avatar Dec 22 '19 16:12 feinstein

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

trqalothman avatar Mar 22 '20 04:03 trqalothman

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

feinstein avatar Mar 22 '20 07:03 feinstein

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

trqalothman avatar Mar 29 '20 07:03 trqalothman

Give it a 👍🏻 (as they prioritize based on thumbs up count) and hope someone will get to fix it.

feinstein avatar Mar 29 '20 07:03 feinstein

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

trqalothman avatar Apr 01 '20 08:04 trqalothman

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 avatar Jul 13 '20 12:07 ajain-bst

@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.

trqalothman avatar Jul 16 '20 02:07 trqalothman

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

trqalothman avatar Nov 15 '20 11:11 trqalothman

need this feature too

jxzy999 avatar Nov 26 '20 07:11 jxzy999

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

sm2017 avatar Jan 04 '21 13:01 sm2017

@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

iapicca avatar Jan 04 '21 14:01 iapicca

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

zmtzawqlp avatar Apr 25 '21 06:04 zmtzawqlp

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

iapicca avatar Apr 25 '21 08:04 iapicca

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: https://github.com/fluttercandies/extended_text_field/issues/80#issuecomment-831232408

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

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

JordanRoberts1 avatar May 05 '21 14:05 JordanRoberts1

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

jowenn avatar May 21 '21 18:05 jowenn

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 :(

trqalothman avatar Jun 28 '21 05:06 trqalothman

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

nailgilaziev avatar Sep 21 '21 21:09 nailgilaziev

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

iapicca avatar Sep 22 '21 05:09 iapicca

@nailgilaziev

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

trqalothman avatar Sep 24 '21 11:09 trqalothman

Hi! We need this, is there any udate?

Ltei avatar Feb 25 '22 14:02 Ltei

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

loic-hamdi avatar Mar 04 '22 16:03 loic-hamdi

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

kaustav07 avatar Mar 07 '22 20:03 kaustav07

We need this feature

booooohdan avatar Mar 13 '22 17:03 booooohdan

For Now this is the only solution available: https://stackoverflow.com/questions/71502532/flutter-text-overflow-at-beginning-of-sentence/71504034#71504034

Vrajs16 avatar Mar 21 '22 14:03 Vrajs16

any news?

Max-Job avatar Nov 24 '22 12:11 Max-Job

2023

hrxiang avatar Jan 11 '23 08:01 hrxiang

2024

z-chu avatar Mar 03 '23 05:03 z-chu

:( i want this too

felixriehm avatar Apr 07 '23 20:04 felixriehm

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

FrankyLee-dev avatar Aug 10 '23 04:08 FrankyLee-dev