Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sized box vs padding for distances in columns and rows

Tags:

flutter

Is there a performance difference between SizedBox and Padding when applying distance inside Column and Row.

Here is an example:

        child: Column(
          children: <Widget>[
            SizedBox(
              height: 30.0,
            ),
            ProfileAvatar(
              photoUrl: vo.photoUrl,
              height: 90.0,
            ),

or this

        child: Column(
          children: <Widget>[
            Padding(
              padding: EdgeInsets.only(top: 30.0),
            ),
            ProfileAvatar(
              photoUrl: vo.photoUrl,
              height: 90.0,
            ),

Which one should be preferred, or recommended by the flutter team?

like image 599
Tree Avatar asked Jun 06 '18 13:06

Tree


1 Answers

I think SizedBox make code easier to read by flatten nested lines of code.

like image 162
CircleOnCircles Avatar answered Oct 19 '22 05:10

CircleOnCircles