How to align a Column's child to the bottom

后端 未结 4 2306
后悔当初
后悔当初 2021-02-18 14:30

I\'m trying to build a generic home page and I want to align the last child of my column (which contains all the widgets for the page) to the bottom of the screen but the widget

4条回答
  •  你的背包
    2021-02-18 15:21

    You can try wrapping the widgets which needs to be at the top inside another Column widget, thereby making the root widget containing only two children. 1st child containing all the widgets which need to be aligned at the top and the 2nd child containing widget which is to be placed at the bottom. Now you use mainAxisAlignment: MainAxisAlignment.spaceBetween to align 1st child to the top and second to the bottom.

    Column(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      mainAxisSize: MainAxisSize.max,
      children: [
        Column(
          children: [
            ChildA(),
            ChildB(),
          ]
        ),
        BottomAlignedChild(),
     ]
    );
    

提交回复
热议问题