Ugurcan Ucar
Ugurcan Ucar

Reputation: 406

Flutter text ellipsis deleting last word

I want to use TextOverflow.ellipsis but its deleting last for for make it ellipsis and its looks really ugly. How can i make it without deleting any word ?

enter image description here

For example when i make with fade and softwrap false its working as i wanted but i want to make it as ellipsis. But when i use ellipsis

enter image description here

Its being like that and its really looks ugly. How can i fix it ? Thanks for helps!

Upvotes: 1

Views: 1000

Answers (3)

Krina chauhan
Krina chauhan

Reputation: 97

You can use ellipse along with softwrap false. it will work as you needed.

Check this out::

Text(
                  'Sikayet viya Danishments',
                  softWrap: false,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    fontSize: 13.0,
                    fontFamily: 'Roboto',
                    color: Colors.purple,
                    fontWeight: FontWeight.bold,
                  ),
                ),

Upvotes: 0

Ugurcan Ucar
Ugurcan Ucar

Reputation: 406

I found the solution. If anyone facing that problem i found a 3rd party library. https://pub.dev/packages/text_helpers With InlineText its worked as i wanted.

Example Code :

                      InlineText(
                        title,
                        style: const TextStyle(
                            color: Color.fromARGB(255, 109, 66, 239),
                            fontSize: 21,
                            fontWeight: FontWeight.w600),
                      ),

enter image description here

Upvotes: 1

Ivo
Ivo

Reputation: 23267

This is a known issue of flutter. See this 4 year old discussion:

https://github.com/flutter/flutter/issues/18761

There are some possible workarounds mentioned there, but none of them are perfect in my opinion.

I also hope that some day it gets fixed but it doesn't look like they are going to fix it any time soon.

Upvotes: 2

Related Questions