将行中不同大小的文本对齐到底部 [英] Align Text of different size in row to bottom

查看:60
本文介绍了将行中不同大小的文本对齐到底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一行中有2个文本。第一个是20号字体,第二个是13号字体。我正在尝试将它们都对齐到底部,但到目前为止还没有运气。就像第一个大的填充物一样。
关于如何对齐两个文本的任何好的提示?

I have a row where the children are 2 Texts. The first is fontsize 20 and the second is size 13. I'm trying to align both to bottom but so far no luck. It's like the first large one gets some additional padding. Any good hints on how to align the two Text?

推荐答案

我认为您需要使用< Row 小部件的code> crossAxisAlignment 和 textBaseline 属性。

I think you need to play around with the crossAxisAlignment and textBaseline properties of your Row widget.

尝试类似以下操作:

Row(
    crossAxisAlignment: CrossAxisAlignment.baseline,
    textBaseline: TextBaseline.alphabetic,
    children: <Widget>[
      Text("foo", style: TextStyle(fontSize: 20)),
      Text("bar", style: TextStyle(fontSize: 13)),
    ],
),

这篇关于将行中不同大小的文本对齐到底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆