In text widget when text overflowing not taking its given width and show ellipse.
issue it gets hides long text and showing ellipse
I have some text long or in between the text line so that I have wrap text widget with Expanded and changed the text widget property to overflow.ellipses
. but long text gets hide and shows only ellipses
Any other way to show long text with ellipse inside the given width
not showing full text
Expanded(
child: Text(
name ?? " ",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15),
),
I also tried changing softwrap=false
but no changes with ellipse
It happens when your text contains white space(that is simple space). If text-overflow is used then it will apply the text-overflow effect right after the white space of text which is so long that it would not fit in the first line.
Since white space is creating the problem we can simply replace white space with an invisible character which is blank space. There is a difference between white space and blank space. The Unicode of white space is \u0020 and the Unicode of blank space is \u00A0.
You just have to use the string replaceAll method to replace white space with blank space : -
Full code : -
Output : -