我的设置:Flutter v1.17.4、Mac OS X 10.15.4、locale en-US、Dart v2.8.4
在泰语中,元音可以出现在辅音的上方和下方。在我的泰语学习应用程序中,我想为辅音设置与其相关元音不同的样式。
使用 Flutter 的 RichText 和 TextSpan,我几乎实现了这一点。但是如下图所示,有一个问题。元音认为它缺少相关的辅音。结果,元音呈现一个虚线圆圈,它期望辅音出现。辅音在前面的 TextSpan 中。
如何让 Flutter 渲染这个泰语文本,使用不同样式的元音和辅音,并且没有红色虚线圆圈?
在下图中创建字符的代码。
RichText thaiConsonantAndVowelAbove(){
return RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(text: "ง", style: TextStyle(color: Colors.white, fontSize: 100)),
TextSpan(text: "ู", style: TextStyle(color: Colors.red, fontSize: 100))
]
)
);
}
@override
Widget build(BuildContext context) {
return Row(children: <Widget>[Expanded(child: thaiConsonantAndVowelAbove(), flex: 1)]);
}