textElevation method

T textElevation(
  1. double elevation, {
  2. double angle = 0.0,
  3. Color color = const Color(0x33000000),
  4. double opacityRatio = 1.0,
})

Implementation

T textElevation(
  double elevation, {
  double angle = 0.0,
  Color color = const Color(0x33000000),
  double opacityRatio = 1.0,
}) {
  double calculatedOpacity = _elevationOpacityCurve(elevation) * opacityRatio;

  Shadow shadow = Shadow(
    color: color.withOpacity(calculatedOpacity),
    blurRadius: elevation,
    offset: Offset(sin(angle) * elevation, cos(angle) * elevation),
  );
  return this.copyWith(
    style: (this.style ?? TextStyle()).copyWith(
      shadows: [
        shadow,
      ],
    ),
  );
}