flutter - 如果 TextSpan 包含不同的语言,则 TextSpan 的背景具有不同的高度
问题描述
如果存在不同的语言(如中文和英文),则 SelectableText.rich 或 RichText 中 textspan 的背景高度不同。
return Scaffold(
backgroundColor: Colors.black,
body: Center(
child: RichText(
text: TextSpan(
text: 'english中文',
style: TextStyle(
color: Colors.red,
backgroundColor: Colors.white,
fontSize: 18.0),
),
)));
以下解决方案不起作用,因为 TextSpan 没有属性 strutStyle。
https://medium.com/@najeira/control-text-height-using-strutstyle-4b9b5151668b
请帮助解决这个问题。谢谢。
解决方案
推荐阅读
- r - 在 R 中,如何自动检测首次出现非标准时差的位置?
- c++ - 循环内的变量被设置为下一个数组的元素是否始终具有相同的内存地址?
- javascript - 如何在 cypress 中将 csv 转换为 JSON
- javascript - 如何使 Jest spOn 第二次调用函数
- html - 具有不同高度的内联块元素内的间隙
- javascript - 了解如何将 ._forEach 变成 _.map
- java - 如何在 java/hibernate/mysql 中加入 2 个或更多表?
- c - 有没有更好的方法从 C 语言的控制台中接受结构中的用户全名?
- javascript - 使用 js 中的正则表达式删除某些区域的引号
- c#-4.0 - 这个错误怎么可能?使用 Imazen.WebP.SimpleDecoder '检测到无效的 WebP 标头'