Home > Enterprise >  Reduce default spacing in column widget
Reduce default spacing in column widget

Time:08-07

I am trying to put some text widgets inside a column, but there is this additional padding that I want to get rid of. Is there any "clean" way to do it? I could probably use Stack and specify the padding for every element in my case, but it is not a scalable solution.

Column(
  mainAxisAlignment: MainAxisAlignment.center,
  children: [
    Text('why'),
    Text('so'),
    Text('stretched'),
  ],
),

default column widget spacing

CodePudding user response:

We have few solutions here:

1/. Add height for style of Text widget, height is double, default is 1.0 You can reduce it to 0.8 or 0.6 or any number as you want.

2/. Add SizedBox wrap your Text widget and set height for this SizedBox as you want.

  • Related