加载中...

Flutter中不同字体大小的文本对齐


Text的高度 是根据 height 乘于 fontSize 进行计算的, 这里指定height即可, 不指定的可能会出现无法对齐的情况。

 Text(
  "0.8920",
  style: TextStyle(
    color: ColorsUtil.hexToColor("#263238"),
    fontSize: 28.sp,
    fontWeight: FontWeight.bold,
    fontFamily: FontFamily.dINAlternateBold,
  ),
),

Text(
  "元/度 (含服务费)",
  style: TextStyle(
    color: ColorsUtil.hexToColor("#B4B4B4"),
    fontSize: 12.sp,
    height: 2.2,
  ),
),

文章作者: km
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 km !