Skip to content

当我们使用行(row)的时候,子组件常常因为高度的不同,导致各个子组件里面的内容不能对齐。这个时候我们可以使用IntrinsicHeight来保持row中各个子组件高度一致,从而便于纵向居中对齐。

参考下面的代码:

IntrinsicHeight(

  child: Row(

    mainAxisAlignment: MainAxisAlignment.spaceBetween,

    children: <Widget>[

      Container(color: Colors.blue, width: 100.0),

      Container(color: Colors.red, width: 50.0,height: 50.0,),

      Container(color: Colors.yellow, width: 150.0),

    ],

  ),

);

点击并拖拽以移动

Lucking