Always display text on two lines

41 Views Asked by At

I have Text:

Text(
  "My long ... long ... text",
  style: const TextStyle(overflow: TextOverflow.ellipsis),
  maxLines: 2,
),

In case text is long, it will be displayed on two lines only. My question is: is it possible to, in case of short text, to take the same space as this long text (as two lines)? I need to calculate the height and therefore I need to take into account two lines everytime. Also in case there is only short text. Thank you for your advise.

1

There are 1 best solutions below

0
Texv On BEST ANSWER

Add \n to create a new line at the end.

 Text(
   '${myString}\n'
 ),