How to remove the gap above and below the text on flutter

Viewed 2175

I am trying to put the text "Hello" right below the "123", but the bigger the text is, the bigger the gap. How do I remove the gap??? Flutter images are added below.

enter image description here

enter image description here

2 Answers

The only way I could find so far is to reduce height property, the problem though is that it reduces the gap above only. So in your case, you could try to set it for hello text to the minimum:

Text(
   '123',
    style: TextStyle(fontSize: 60.0),
),
Text(
   'hello',
    style: TextStyle(fontSize: 10.0, height: 0.1),
),

Use Stack widget to align your text widgets

Stack(
      children: <Widget>[
        Text(
          '123',
          style: TextStyle(fontSize: 60.0),
        ),
        Positioned(
          child: Text('Hello'),
          bottom: 0.0,
          left: 35.0,
        )
      ],
    ),

Hope it helps!

Related