Flutter-容器中的文本顶部对齐 [英] Flutter - Top align text in Container
本文介绍了Flutter-容器中的文本顶部对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将 $
文本保留在容器顶部,但即使使用 FractionalOffset(1.0,0.0)
$
文本继续在容器的中间。
I'm trying to leave the $
text in the top of the container, but even with FractionalOffset(1.0, 0.0)
the $
text continues in the middle of the container.
如何做才能离开 $
放在容器顶部?
What could be done to leave the $
in the top of the container?
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'),
],
),
),
推荐答案
尝试给您的 Row
一个 CrossAxisAlignment
的 CrossAxisAlignment.start
。
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'),
],
),
),
这篇关于Flutter-容器中的文本顶部对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文