首页 > 解决方案 > 颤动:将小部件对齐/固定到行的底部

问题描述

如何将所有项目对齐到Row颤振的底部?我有一个小部件,Row它在运行时改变它的高度,因此,Row自动居中的所有其他小部件也是如此。我的问题是:如何防止这些其他小部件移动并将它们固定在底部?

标签: flutteralignmentflutter-layout

解决方案


您正在寻找的是CrossAxisAlignment

Row(
  crossAxisAlignment: CrossAxisAlignment.end,
  children: <Widget>[
    Container(width: 100, height: 200, color: Colors.red),
    Container(width: 100, height: 300, color: Colors.blue),
    SizedBox(
      width: 100,
      height: 150,
      child: FittedBox(
        fit: BoxFit.contain,
        child: const FlutterLogo(),
      ),
    ),
  ],
)

推荐阅读