扑动:将小部件对齐/固定到行的底部
flutter: Align / pin widgets to bottom of row
如何在 flutter 中将所有项目对齐到 Row
的底部?我在 Row
中有一个小部件,它会在运行时更改其高度,因此,Row
的所有其他小部件也会自动居中。我的问题是:如何防止这些其他小部件移动并将它们固定到底部?
您要找的是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(),
),
),
],
)
Row(
crossAxisAlignment: CrossAxisAlignment.end,
)
I hope you succeeded
如何在 flutter 中将所有项目对齐到 Row
的底部?我在 Row
中有一个小部件,它会在运行时更改其高度,因此,Row
的所有其他小部件也会自动居中。我的问题是:如何防止这些其他小部件移动并将它们固定到底部?
您要找的是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(),
),
),
],
)
Row(
crossAxisAlignment: CrossAxisAlignment.end,
)
I hope you succeeded