简而言之,使用Colors.transparent隐藏实际文本,然后显示一个悬停在Text下划线上方的偏移阴影
Text(
"Forgot Password?",
style: TextStyle(
shadows: [
Shadow(
color: Colors.black,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration:
TextDecoration.underline,
decorationColor: Colors.blue,
decorationThickness: 4,
decorationStyle:
TextDecorationStyle.dashed,
),
)
实际效果: