如何将小部件对齐到Column类的顶部?

时间:2018-07-05 09:31:02

标签: dart flutter flutter-layout

我应该更改哪个参数以将“ childen:[...]”值适合UI的顶部? (当前,他们正在填充容器中的所有免费订单)。 预先感谢您的解释!! 代码段:

return new Container(
  child: new Column (
    crossAxisAlignment: CrossAxisAlignment.start,
    mainAxisSize: MainAxisSize.min,


    children: <Widget>[
      new Text('\$$priceUsd\n'),
  new Text('1 hour: $percentChange1h%',
    style: new TextStyle(
        color: changeColor),


    )],
  )
);

enter image description here

1 个答案:

答案 0 :(得分:2)

只需将主轴对齐设置为起点 返回新的容器(

  child: new Column (
    crossAxisAlignment: CrossAxisAlignment.start,
    mainAxisAlignment: MainAxisAlignment.start,
    mainAxisSize: MainAxisSize.min,


    children: <Widget>[
      new Text('\$$priceUsd\n'),
  new Text('1 hour: $percentChange1h%',
    style: new TextStyle(
        color: changeColor),


    )],
  )
);

enter image description here