Warm tip: This article is reproduced from serverfault.com, please click

flutter: Align / pin widgets to bottom of row

发布于 2020-12-08 15:16:44

How is it possible to align all items to the bottom of a Row in flutter? I have got one widget in the Row which changes its height at runtime and due to that, all other widgets of the Row automatically center themselves, too. My question is: how do you prevent these other widgets from moving and pin them to the bottom?

Questioner
larsaars
Viewed
0
Stefano A. 2020-12-08 23:30:32

What you're looking for is 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(),
      ),
    ),
  ],
)