Flutter : Vertically center column

后端 未结 9 601
失恋的感觉
失恋的感觉 2020-12-13 23:02

How to vertically center a column in Flutter? I have used widget \"new Center\". I have used widget \"new Center\", but it does not vertically center my column ? Any ideas w

9条回答
  •  盖世英雄少女心
    2020-12-13 23:42

    While using Column, use this inside the column widget :

    mainAxisAlignment: MainAxisAlignment.center

    It align its children(s) to the center of its parent Space is its main axis i.e. vertically

    or, wrap the column with a Center widget:

    Center(
      child: Column(
        children: ,
      ),
    )
    

    if it doesn't resolve the issue wrap the parent container with a Expanded widget..

    Expanded(
       child:Container(
         child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           children: children,
         ),
       ),
    )
    

提交回复
热议问题