Reputation: 337
I'm trying to use the RichText widget with ellipsis on text overflow, but the dots are shown separated by a space of the last word, like this:
"Lorem Ipsum is simply dummy text of the printing and ..."
When the correct form should be like this:
"Lorem Ipsum is simply dummy text of the printing and..."
This is the code:
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(text: "Lorem Ipsum is simply dummy text "),
TextSpan(
text: "of the printing and typesetting industry",
style: TextStyle(
fontStyle: FontStyle.italic
),
),
]),
),
)
Is there a solution for this?
Upvotes: 2
Views: 10772
Reputation: 2711
not fully sure but remove the space from last
change "Lorem Ipsum is simply dummy text "
to "Lorem Ipsum is simply dummy text"
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(text: "Lorem Ipsum is simply dummy text"),
TextSpan(
text: "of the printing and typesetting industry",
style: TextStyle(
fontStyle: FontStyle.italic
),
),
]),
),
)
i hope it helps..
Upvotes: 5
Reputation: 3015
This space is actually space of the text. When I try your code, my result is here,
If I remove g char into typesetting, result is
So, I think its not about ellipsis or richtext. Maybe not the exact answer but maybe you can think something else.
Upvotes: 0