简体   繁体   English

如何使容器从 flutter 中的同一个 position 开始

[英]How to make containers start from the same position in flutter

Iam trying to create a figure like this using containers in flutter我正在尝试使用 flutter 中的容器创建这样的图形
我正在尝试使用 untainers 创建这样的图像

I wrote the following code.我写了以下代码。

Row(
       mainAxisAlignment: MainAxisAlignment.center,
       children: <Widget>[       
          Container(width: 5, height: 10, color: Colors.green),
          Container(width: 5, height: 15, color: Colors.green),
          Container(width: 5, height: 20, color: Colors.green),
          Container(width: 5, height: 25, color: Colors.green),
          Container(width: 5, height: 30, color: Colors.green),
        ],
    ),

I get the follwing output.我得到以下 output。
在此处输入图像描述
How to I make all the containers to start from the same level.如何使所有容器从同一级别开始。

Thank You.谢谢你。

Add crossAxisAlignment: CrossAxisAlignment.end to your RowcrossAxisAlignment: CrossAxisAlignment.end添加到您的Row

Row(
      crossAxisAlignment: CrossAxisAlignment.end,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Container(width: 5, height: 10, color: Colors.green),
        Container(width: 5, height: 15, color: Colors.green),
        Container(width: 5, height: 20, color: Colors.green),
        Container(width: 5, height: 25, color: Colors.green),
        Container(width: 5, height: 30, color: Colors.green),
      ],
    ),

Use this code使用此代码

  Row(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: <Widget>[
          Container(width: 5, height: 10, color: Colors.green),
          Container(width: 5, height: 15, color: Colors.green),
          Container(width: 5, height: 20, color: Colors.green),
          Container(width: 5, height: 25, color: Colors.green),
          Container(width: 5, height: 30, color: Colors.green),
        ],
      ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM