build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Use the old color but apply the following changes

Implementation

@override
Widget build(BuildContext context) {
  return ShaderMask(
    /// Optional, specifies how the
    /// shader blends with the child
    blendMode: BlendMode.srcIn,

    /// Define the shader here
    shaderCallback: (bounds) => gradient.createShader(
      Rect.fromLTWH(0, 0, bounds.width, bounds.height),
    ),

    /// The widget you want
    /// to apply the shader to
    child: Text(text, style: style),
  );
}