withGradient method
Applies a gradient effect to the text.
Implementation
Widget withGradient(List<Color> colors) {
return ShaderMask(
shaderCallback: (bounds) {
return LinearGradient(colors: colors).createShader(
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
);
},
child: withColor(Colors.white), // Ensures text visibility.
);
}