createPaint method
Evaluates the painting effect at animation value t
typically used to create shaders e.g LinearGradient shaders
Implementation
@override
Paint createPaint(double t, Rect rect, TextDirection? textDirection) {
final beginX = begin.resolve(textDirection).x;
final endX = end.resolve(textDirection).x;
final isVertical = beginX == 0 && endX == 0;
return Paint()
..shader = LinearGradient(
colors: colors,
stops: stops,
begin: begin,
end: end,
tileMode: tileMode,
transform: _SlidingGradientTransform(offset: t, isVertical: isVertical),
).createShader(rect, textDirection: textDirection);
}