Flutter:Text.Rich小部件是RECTREVER RECERS,如果您添加阿拉伯语文本
请有人帮助我吗? text.Rich小部件与阿拉伯文本无法成功使用。文本方向存在问题。 让我们举个例子 当我运行应用程序时,以下代码中容器的顺序反向发生 对我来说这是一个大问题
Text.rich(
TextSpan(
children: [
TextSpan(text: 'بِسۡمِ ٱللَّهِ ٱلرَّحۡمَٰنِ ٱلرَّحِيمِ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.green,child:Text('1'),
),
),
TextSpan(text: 'ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِينَ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.blue,child:Text('2'),
),
),
TextSpan(text: 'ٱلرَّحۡمَٰنِ ٱلرَّحِيمِ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.red,child:Text('3'),
),
),
],
),
textDirection: TextDirection.rtl,
)
please can any one help me?
Text.rich widget does not work successfully with arabic text. there are a problem with the text direction.
lets give an example
when i run the app the order of the container in the below code is come reverse
that is a big problem for me
Text.rich(
TextSpan(
children: [
TextSpan(text: 'بِسۡمِ ٱللَّهِ ٱلرَّحۡمَٰنِ ٱلرَّحِيمِ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.green,child:Text('1'),
),
),
TextSpan(text: 'ٱلۡحَمۡدُ لِلَّهِ رَبِّ ٱلۡعَٰلَمِينَ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.blue,child:Text('2'),
),
),
TextSpan(text: 'ٱلرَّحۡمَٰنِ ٱلرَّحِيمِ'),
WidgetSpan(
child: Container(
width: 30,
height: 30,
color: Colors.red,child:Text('3'),
),
),
],
),
textDirection: TextDirection.rtl,
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有时,最困难的问题可以通过非常简单的事情来解决。
解决这个问题可能有许多漫长而困难的方法。
[https://github.com/flutter/flutter/issues/54400#issuecomment-662558160] [1]
但是我发现的最简单方法是
Sometimes the most difficult problems can be solved by very simple things.
There may be many long and difficult ways to solve this problem.
[https://github.com/flutter/flutter/issues/54400#issuecomment-662558160][1]
But the simplest way that i found is
那是因为您是
widgetSpan
textspan
s之间的 s毁灭textDirection
,因为widgetspan
不遵循方向性,< br>您可以用
textspan
替换widgetspan
,它将工作我测试IDThat's because you are
WidgetSpan
s betweenTextSpan
s which ruins theTextDirection
becauseWidgetSpan
does not follow the directionality,you can replace the
WidgetSpan
with aTextSpan
and it will work I tested id