Space between Column's children in Flutter

后端 未结 14 818
刺人心
刺人心 2021-02-02 04:33

I have a Column widget with two TextField widgets as children and I want to have some space between both of them.

I already tried mainAxi

14条回答
  •  囚心锁ツ
    2021-02-02 05:23

    You can put a SizedBox with a specific height between the widgets, like so:

    Column(
      children: [
        FirstWidget(),
        SizedBox(height: 100),
        SecondWidget(),
      ],
    ),
    

    Why to prefer this over wrapping the widgets in Padding? Readability! There is less visual boilerplate, less indention and the code follows the typical reading-order.

提交回复
热议问题