gpt4 book ai didi

flutter - 对两个文本小部件仅使用一次“对齐”

转载 作者:行者123 更新时间:2023-12-03 04:53:56 28 4
gpt4 key购买 nike

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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com