【发布时间】:2022-01-16 21:27:30
【问题描述】:
【问题讨论】:
标签: flutter text border flutter-text
【问题讨论】:
标签: flutter text border flutter-text
只需在 Flutter 文档中查找 TextStyle 类即可。我相信在 Borders an Stroke 中您会找到答案。
【讨论】:
请参考outlined_text包here
【讨论】:
我在Flutter Documentation找到了答案
没有边框属性,但是您可以使用两个重叠的文本来完成这项工作。这是代码
Stack(
children: <Widget>[
// Stroked text as border.
Text(
'WHO',
style: TextStyle(
fontSize: 40,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 6
..color = Colors.grey,
),
),
// Solid text as fill.
Text(
'WHO',
style: TextStyle(
fontSize: 40,
color: Colors.red,
),
),
],
)
【讨论】: