textElevation method
void
textElevation(})
Elevates the text with a shadow.
angle
format depends on what is specified in the style widget`s constructor.
..textElevation(30.0, color: Colors.grey, angle: 0.0)
Implementation
void textElevation(double elevation,
{double angle = 0.0,
Color color = const Color(0x33000000),
double opacity = 1.0}) {
if (elevation == 0) return;
angle = angleToRadians(angle, angleFormat);
final double offsetX = sin(angle) * elevation;
final double offsetY = cos(angle) * elevation;
// custom curve defining the opacity
double calculatedOpacity = (0.5 - (sqrt(elevation) / 19)) * opacity;
if (calculatedOpacity < 0.0) calculatedOpacity = 0.0;
final Color colorWithOpacity = color.withOpacity(calculatedOpacity);
_textModel.textShadow = [
Shadow(
color: colorWithOpacity,
blurRadius: elevation,
offset: Offset(offsetX, offsetY))
];
}