buildPaint method
You can override buildPaint for add paint filters. For example, grayscale animation:
@override
Paint buildPaint() => super.buildPaint()
..colorFilter = const ColorFilter.matrix(<double>[
0.2126, 0.7152, 0.0722, 0, 0,
0.2126, 0.7152, 0.0722, 0, 0,
0.2126, 0.7152, 0.0722, 0, 0,
0, 0, 0, 1, 0
]);
\see defaultPaint
Implementation
@mustCallSuper
Paint buildPaint() {
final Paint p = defaultPaint ?? Paint()
..isAntiAlias = true;
return p..color = p.color.withOpacity(globalAlpha);
}