before method
Before we draw this layer
Implementation
@override
void before(Canvas canvas, Size size) {
canvas.saveLayer(Rect.largest, Paint());
canvas.drawRect(
Rect.fromLTWH(0, 0, size.width, size.height),
Paint()
..shader = LinearGradient(colors: [
Colors.black,
Colors.black.withOpacity(max(1.0 - time / 5, 0)),
Colors.black
], transform: GradientRotation(time / 10))
.createShader(Rect.fromLTWH(0, 0, size.width, size.height)));
}