scale method Null safety

  1. @override
SweepGradient scale(
  1. double factor
)
override

Returns a new SweepGradient with its colors scaled by the given factor.

Since the alpha component of the Color is what is scaled, a factor of 0.0 or less results in a gradient that is fully transparent.

Implementation

@override
SweepGradient scale(double factor) {
  return SweepGradient(
    center: center,
    startAngle: startAngle,
    endAngle: endAngle,
    colors: colors.map<Color>((Color color) => Color.lerp(null, color, factor)!).toList(),
    stops: stops,
    tileMode: tileMode,
  );
}