【发布时间】:2021-07-12 10:38:07
【问题描述】:
我正在尝试为 textspan 添加背景颜色,因为我不想为此使用容器,但是一个透明的洞不知从何而来。如何解决?
我的代码是
RichText(
text: TextSpan(text: 'TEST: ', children: [
TextSpan(
text: 'HELLO',
style: TextStyle(
background: Paint()
..color = Colors.red
..strokeWidth = 10
..style = PaintingStyle.stroke,
fontWeight: FontWeight.bold),
)
]),
)
它是一个绿色容器的子容器。
我在文本“Hello”后面得到this image 的输出。
如何使红色不透明?
【问题讨论】:
-
您能否显示包含此 RichText 的父级的完整代码,因为我看到的是有一个边框覆盖了“Hello”文本