applyBounds method
Apply the bounds and transform the shader.
Implementation
@override
RadialGradient applyBounds(Rect bounds, AffineMatrix transform) {
assert(offsets != null);
assert(colors != null);
AffineMatrix accumulatedTransform = this.transform ?? AffineMatrix.identity;
switch (unitMode ?? GradientUnitMode.objectBoundingBox) {
case GradientUnitMode.objectBoundingBox:
accumulatedTransform = transform
.translated(bounds.left, bounds.top)
.scaled(bounds.width, bounds.height)
.multiplied(accumulatedTransform);
break;
case GradientUnitMode.userSpaceOnUse:
accumulatedTransform = transform.multiplied(accumulatedTransform);
break;
case GradientUnitMode.transformed:
break;
}
return RadialGradient(
id: id,
center: center,
radius: radius,
colors: colors,
offsets: offsets,
tileMode: tileMode ?? TileMode.clamp,
transform: accumulatedTransform,
focalPoint: focalPoint,
unitMode: GradientUnitMode.transformed,
);
}