如何使图标相对于RichText中的文本对齐?
我有一个文本位于Richtext,n,我想在几点之后进行单击,文字旁边有一个图标。问题在于,图标与文本相对于文本无法正确对齐,当它的大小增加时,这一点尤其明显。如何使图标和文本在中心的同一行上?对齐中心无助
RichText(
textAlign: TextAlign.center,
text: TextSpan(
children: [
TextSpan(text: 'Next ', style: richBotton),
WidgetSpan(
child: Icon(Icons.arrow_forward_ios, color: Colors.grey, size: 11,)
),
],
),
),
于样式
final richBotton = const TextStyle(color: Color.fromARGB(255, 117, 117, 117), fontSize: 11,);
final text = const TextStyle(color: Colors.grey, fontSize: 11);
- 我的代码
- 与
callignment:packholdSeralignment.middle
middle - 使用
对齐:占位型
对齐:loctholderalignment.bottom
I have a text located in RichText, n how much later I want to make it clickable, there is an icon next to the text. The problem is that the icon does not align correctly relative to the text, this is especially noticeable when its size increases. How do I make the icon and text to be on the same line in the center ? Align centered doesn't help
RichText(
textAlign: TextAlign.center,
text: TextSpan(
children: [
TextSpan(text: 'Next ', style: richBotton),
WidgetSpan(
child: Icon(Icons.arrow_forward_ios, color: Colors.grey, size: 11,)
),
],
),
),
for styles
final richBotton = const TextStyle(color: Color.fromARGB(255, 117, 117, 117), fontSize: 11,);
final text = const TextStyle(color: Colors.grey, fontSize: 11);
- My code
- With
alignment: PlaceholderAlignment.Middle
- With
alignment: PlaceholderAlignment.Top
- With
alignment: PlaceholderAlignment.Bottom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
widgetspan
上包含对齐:loctholdSeralign.middle
。You can include
alignment: PlaceholderAlignment.middle
onWidgetSpan
.