gpt4 book ai didi

dart - Flutter - 容器中的顶部对齐文本

转载 作者:IT老高 更新时间:2023-10-28 12:30:43 25 4
gpt4 key购买 nike

我试图将 $ 文本留在容器顶部,但即使使用 FractionalOffset(1.0, 0.0) $ 文本在容器中间继续。

如何将 $ 留在容器顶部?

  body: new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Container(
padding: new EdgeInsets.only(top: 16.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Container(
alignment: new FractionalOffset(1.0, 0.0),
child: new Text(
'\$ ',
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'Roboto',
color: new Color(0xFF26C6DA),
)
)
),
new Text(
'3,435.23',
style: new TextStyle(
fontSize: 35.0,
fontFamily: 'Roboto',
color: new Color(0xFF26C6DA)
),
)
],
),
),
new Text('general balance'),
],
),
),

enter image description here

最佳答案

尝试为您的 Row 提供 CrossAxisAlignment.startCrossAxisAlignment。这是你的想法吗?

screenshot

 body: new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Container(
padding: new EdgeInsets.only(top: 16.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
'\$ ',
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'Roboto',
color: new Color(0xFF26C6DA),
)
),
new Text(
'3,435.23',
style: new TextStyle(
fontSize: 35.0,
fontFamily: 'Roboto',
color: new Color(0xFF26C6DA)
),
)
],
),
),
new Text('general balance'),
],
),
),

关于dart - Flutter - 容器中的顶部对齐文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44525119/

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