textShadow method

T textShadow({
  1. Color color = const Color(0x33000000),
  2. double blurRadius = 0.0,
  3. Offset offset = Offset.zero,
})

为文本添加阴影效果

参数:

  • color: 阴影颜色,默认为半透明黑色
  • blurRadius: 阴影的模糊半径,默认为 0.0
  • offset: 阴影的偏移量,默认为 Offset.zero

返回: 应用了阴影效果的 TextSpan 对象

Implementation

T textShadow({
  Color color = const Color(0x33000000),
  double blurRadius = 0.0,
  Offset offset = Offset.zero,
}) =>
    this.copyWith(
      style: (style ?? const TextStyle()).copyWith(
        shadows: [
          Shadow(
            color: color,
            blurRadius: blurRadius,
            offset: offset,
          ),
        ],
      ),
    );