有时想将我的Expanded
类与end
对齐,有时甚至要与start
对齐。如何将Expanded
类与if
语句对齐?
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
new Text(defaultUserName, style: Theme.of(ctx).textTheme.subhead),
new Container(
margin: const EdgeInsets.only(top: 10.0,right: 10.0),
child: new Text(txt),
),
],
),
),
答案 0 :(得分:4)
使用方式:
crossAxisAlignment: _alignEnd ? CrossAxisAlignment.end : CrossAxisAlignment.start,