shundong106

效果图下

其实思路很简单 与css图层样式叠加类似

我们巧妙用原生库里面的Stack Widget实现这个效果

Stack(
  children: <Widget>[
    // Stroked text as border.
    Text(
      \'Test Text~\',
      style: TextStyle(
        fontSize: 40,
        foreground: Paint()
        ..style = PaintingStyle.stroke
        ..strokeWidth = 6
        ..color = Colors.blue[700],
      ),
    ),
    // Solid text as fill.
    Text(
      \'Test Text~\',
      style: TextStyle(
        fontSize: 40,
        color: Colors.grey[300],
      ),
    ),
  ],
)

官方文档也是有案例的:https://api.flutter.dev/flutter/painting/TextStyle-class.html

分类:

技术点:

相关文章:

  • 2021-09-27
  • 2021-11-23
  • 2021-09-27
  • 2021-10-23
  • 2021-09-27
  • 2021-09-27
  • 2021-09-27
猜你喜欢
  • 2021-09-27
  • 2021-09-27
  • 2021-09-27
  • 2021-09-23
  • 2021-12-26
  • 2021-09-16
相关资源
相似解决方案