I have two simple Text
-Widgets in a Row
that have different font sizes. I use CrossAxisAlignment.start
to vertically place them at the beginning of the vertical axis. Unfortunately, the two text chunks are not correctly aligned. When I use Flutter: Inspect Widget
in VSCode, I can see that both Text
-Widgets have some vertical spacing to the top of the row, which increases with font size. This reminds me of the line-height
attribute in CSS, but I have not found an equivalent in Flutter.
Is there any way to render a Text
-Widget's content without this spacing?
To reproduce this behavior, use the following Row
inside the Flutter Create demo App:
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('First', style: TextStyle(fontSize: 50),),
Text('Second', style: TextStyle(fontSize: 20)),
],
),