transform method

  1. @override
Matrix4? transform(
  1. Rect bounds, {
  2. TextDirection? textDirection,
})
override

When a Gradient creates its Shader, it will call this method to determine what transform to apply to the shader for the given Rect and TextDirection.

Implementers may return null from this method, which achieves the same final effect as returning Matrix4.identity.

Implementation

@override
Matrix4? transform(Rect bounds, {TextDirection? textDirection}) {
  return Matrix4.translationValues(bounds.width * slidePercent, 0.0, 0.0);
}