在Flutter中如何将部件对齐到ROW的顶部

9
我在 ROW 中遇到一个问题,其中一个子元素有很多项,因此它很大,而另一个子元素只有几项,因此其高度很小,所以较少的项显示在 ROW 的中心,因此我需要将其对齐到 ROW 内部的顶部,请查看图像。

enter image description here

请查看我的代码。
rowList = Row(
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
  children: mainBodyList,
);

主体列表
  Container(
   width: screenWidth * 0.49,
   child: Card(
    color: Colors.white,
    child: Column(
      children: <Widget>[
        Container(
          //width: 200,
          padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
          decoration: BoxDecoration(
            color: Colors.black12,
          ),
          child: Row(
            children: <Widget>[
              ClipOval(
                child: Material(
                  color: Colors.white,
                  child: SizedBox(
                    width: 40,
                    height: 40,
                    child:
                        /*Image.asset(
                                        'assets/icons/doc_icon.png'),*/
                        Icon(
                      Icons.playlist_add_check,
                      color: AppTheme.primaryColor,
                    ),
                  ),
                ),
              ),
              Flexible(
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Text(
                        _localization.localeString(name),
                        style: TextStyle(color: AppTheme.primaryColor),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
        Container(
          child: Column(
            children: _dynamicListWidget(list),
          ),
        ),
      ],
    ),
  ),
);
1个回答

30

您需要将crossAxisAlignment设置为CrossAxisAlignment.start

Row(
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
  crossAxisAlignment: CrossAxisAlignment.start,
  children: mainBodyList,
);

我还有另一个问题,看看你能否回答。 - Anas Reza

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接