Widget _createProfileContainer() {
return new Container(
height: 64.0,
child: new Row(children: [
new Expanded(
child: new Container(
color: Colors.cyanAccent,
child: new Column(children: [
Align(
alignment: Alignment.centerLeft,
child: new Text("Today",
style: new TextStyle(
fontSize: 19.0, color: Colors.black))),
Align(
alignment: Alignment.centerLeft,
child: new Text("Thuersday, 26 March"))
]))),
]));
}
很好,一切正常。两个文本(今天和 3月26日,星期四)在左侧对齐。但是我应用两次对齐。是否可以仅应用一次对齐?
最佳答案
您可以使用crossAxisAlignment property对齐列中的所有子项
Column(
children: [
Text("Today",
style: TextStyle(
fontSize: 19.0, color: Colors.black
)
),
Text("Thuersday, 26 March")
],
crossAxisAlignment: CrossAxisAlignment.start
)
关于flutter - 对两个文本小部件仅使用一次“对齐”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60885595/