提问人:Jaafar Melhem 提问时间:11/8/2022 更新时间:11/8/2022 访问量:235
增加 TextDecoration 行中的距离 - flutter
Increase the distance in the TextDecoration line - flutter
问:
“文本”小部件中是否有属性可以增加文本与TextDecoration属性中的下划线之间的距离?
例:
Text('Example',style: TextStyle(color: Colors.black,fontSize:15 ,decoration: TextDecoration.underline,fontWeight: FontWeight.bold),),
答:
2赞
Ye Lwin Oo
11/8/2022
#1
没有内置的解决方案,但可以四处走动。 您需要创建文本阴影并更改其颜色。这是可见的。 原始文本颜色必须是透明的。 然后使用 Offset 属性使用任意数量的空间。
Text('Text and underline space',
style: TextStyle(
color: Colors.transparent,
decorationColor: Colors.grey,
/// change -20 to as many space as you need but it must be less than 0
shadows: [Shadow(color: Colors.white, offset: Offset(0, -20))],
decoration: TextDecoration.underline,
decorationThickness: 3))
评论