Container(
decoration: BoxDecoration(
color: Colors.blue,
border: Border.all(width: 1.0,color: Colors.red)
),
child: Text('11111111 '),
),
When I look at the effect of this Container, all the spaces after 111... are not displayed, unless I add a non-space character at the end. How can I solve this?
It looks like at the moment, the trailing whitespaces can't be kept in any way, since they are removed at a lower level, by the Flutter engine in C++, when calculating the line breaks.
A Text
is actually a RichText
which contains a TextSpan
, itself rendered by a ParagraphBuilder
belonging to dart:ui
(link here). And the thing is that when the paragraph is rendered, line breaks are calculated by a third party member of the Flutter engine, which remove every trailing spaces (link here, see line 173).
I'd suggest to fill a new issue on Github to mention that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With