wrap method
Wraps the child widget with this specific visual effect.
Implementation
@override
Widget wrap(BuildContext context, Widget child, double progress) {
final random = math.Random((progress * 1000).toInt());
final bool glitchTrigger = random.nextDouble() < 0.15;
if (!glitchTrigger) return child;
final double skewX = (random.nextDouble() * 0.08 - 0.04) * intensity;
final double offsetX = (random.nextDouble() * 8.0 - 4.0) * intensity;
final double offsetY = (random.nextDouble() * 8.0 - 4.0) * intensity;
return Transform(
transform: Matrix4.skewX(skewX)
..multiply(Matrix4.translationValues(offsetX, offsetY, 0.0)),
child: child,
);
}