max podgorny
max podgorny

Reputation: 733

How to align widgets to top in Column class?

Which parameter should I change to fit the values fom "childen : [...]" to the top in UI? (Currently they are filling all free spase in the Container). Thank you in advance for explanation!! Code snippet:

return new Container(
  child: new Column (
    crossAxisAlignment: CrossAxisAlignment.start,
    mainAxisSize: MainAxisSize.min,


    children: <Widget>[
      new Text('\$$priceUsd\n'),
  new Text('1 hour: $percentChange1h%',
    style: new TextStyle(
        color: changeColor),


    )],
  )
);

enter image description here

Upvotes: 7

Views: 10288

Answers (1)

Raouf Rahiche
Raouf Rahiche

Reputation: 31356

just set the main axis alignment to the start

return new Container(

  child: new Column (
    crossAxisAlignment: CrossAxisAlignment.start,
    mainAxisAlignment: MainAxisAlignment.start,
    mainAxisSize: MainAxisSize.min,


    children: <Widget>[
      new Text('\$$priceUsd\n'),
      new Text('1 hour: $percentChange1h%',
        style: new TextStyle(color: changeColor),
    )],
  )
);

enter image description here

Upvotes: 11

Related Questions